Package com.itextpdf.forms.fields
Class PdfFormCreator
- java.lang.Object
-
- com.itextpdf.forms.fields.PdfFormCreator
-
public final class PdfFormCreator extends java.lang.Object
Creator which shall be used in order to create all form related instances. By defaultPdfFormFactory
is used.
-
-
Field Summary
Fields Modifier and Type Field Description private static PdfFormFactory
factory
-
Constructor Summary
Constructors Modifier Constructor Description private
PdfFormCreator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PdfButtonFormField
createButtonFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a button form field as a parent of aPdfWidgetAnnotation
using provided factory.static PdfButtonFormField
createButtonFormField(PdfDictionary dictionary)
Creates a button form field as a wrapper object around aPdfDictionary
using provided factory.static PdfButtonFormField
createButtonFormField(PdfDocument document)
Create a minimal, emptyPdfButtonFormField
using provided factory.static PdfChoiceFormField
createChoiceFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a choice form field as a parent of aPdfWidgetAnnotation
using provided factory.static PdfChoiceFormField
createChoiceFormField(PdfDictionary dictionary)
Creates a choice form field as a wrapper object around aPdfDictionary
using provided factory.static PdfChoiceFormField
createChoiceFormField(PdfDocument document)
Create a minimal, emptyPdfChoiceFormField
using provided factory.static PdfFormAnnotation
createFormAnnotation(PdfWidgetAnnotation widget, PdfDocument document)
Creates a form field annotation as a wrapper of aPdfWidgetAnnotation
using provided factory.static PdfFormAnnotation
createFormAnnotation(PdfDictionary dictionary)
Creates a form field annotation as a wrapper object around aPdfDictionary
using provided factory.static PdfFormField
createFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a form field as a parent of aPdfWidgetAnnotation
using provided factory.static PdfFormField
createFormField(PdfDictionary dictionary)
Creates a form field as a wrapper object around aPdfDictionary
using provided factory.static PdfFormField
createFormField(PdfDocument document)
Create a minimal, emptyPdfFormField
using provided factory.static PdfSignatureFormField
createSignatureFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a signature form field as a parent of aPdfWidgetAnnotation
using provided factory.static PdfSignatureFormField
createSignatureFormField(PdfDictionary dictionary)
Creates a signature form field as a wrapper object around aPdfDictionary
using provided factory.static PdfSignatureFormField
createSignatureFormField(PdfDocument document)
Create a minimal, emptyPdfSignatureFormField
using provided factory.static PdfTextFormField
createTextFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a text form field as a parent of aPdfWidgetAnnotation
using provided factory.static PdfTextFormField
createTextFormField(PdfDictionary dictionary)
Creates a text form field as a wrapper object around aPdfDictionary
using provided factory.static PdfTextFormField
createTextFormField(PdfDocument document)
Create a minimal, emptyPdfTextFormField
using provided factory.static PdfAcroForm
getAcroForm(PdfDocument document, boolean createIfNotExist)
Retrieves AcroForm from the document using provided factory.static void
setFactory(PdfFormFactory factory)
SetPdfFormFactory
to be used for form related instances creation.
-
-
-
Field Detail
-
factory
private static PdfFormFactory factory
-
-
Method Detail
-
setFactory
public static void setFactory(PdfFormFactory factory)
SetPdfFormFactory
to be used for form related instances creation.- Parameters:
factory
-PdfFormFactory
to set
-
createFormField
public static PdfFormField createFormField(PdfDocument document)
Create a minimal, emptyPdfFormField
using provided factory.- Parameters:
document
- ThePdfDocument
instance.- Returns:
- created
PdfFormField
-
createFormField
public static PdfFormField createFormField(PdfDictionary dictionary)
Creates a form field as a wrapper object around aPdfDictionary
using provided factory. ThisPdfDictionary
must be an indirect object.- Parameters:
dictionary
- the dictionary to be wrapped, must have an indirect reference.- Returns:
- created
PdfFormField
-
createFormField
public static PdfFormField createFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a form field as a parent of aPdfWidgetAnnotation
using provided factory.- Parameters:
widget
- The widget which will be a kid of thePdfFormField
.document
- ThePdfDocument
instance.- Returns:
- created
PdfFormField
-
createTextFormField
public static PdfTextFormField createTextFormField(PdfDocument document)
Create a minimal, emptyPdfTextFormField
using provided factory.- Parameters:
document
- ThePdfDocument
instance.- Returns:
- created
PdfTextFormField
-
createTextFormField
public static PdfTextFormField createTextFormField(PdfDictionary dictionary)
Creates a text form field as a wrapper object around aPdfDictionary
using provided factory. ThisPdfDictionary
must be an indirect object.- Parameters:
dictionary
- the dictionary to be wrapped, must have an indirect reference.- Returns:
- created
PdfTextFormField
-
createTextFormField
public static PdfTextFormField createTextFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a text form field as a parent of aPdfWidgetAnnotation
using provided factory.- Parameters:
widget
- The widget which will be a kid of thePdfTextFormField
.document
- ThePdfDocument
instance.- Returns:
- created
PdfTextFormField
-
createButtonFormField
public static PdfButtonFormField createButtonFormField(PdfDocument document)
Create a minimal, emptyPdfButtonFormField
using provided factory.- Parameters:
document
- ThePdfDocument
instance.- Returns:
- created
PdfButtonFormField
-
createButtonFormField
public static PdfButtonFormField createButtonFormField(PdfDictionary dictionary)
Creates a button form field as a wrapper object around aPdfDictionary
using provided factory. ThisPdfDictionary
must be an indirect object.- Parameters:
dictionary
- the dictionary to be wrapped, must have an indirect reference.- Returns:
- created
PdfButtonFormField
-
createButtonFormField
public static PdfButtonFormField createButtonFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a button form field as a parent of aPdfWidgetAnnotation
using provided factory.- Parameters:
widget
- The widget which will be a kid of thePdfButtonFormField
.document
- ThePdfDocument
instance.- Returns:
- created
PdfButtonFormField
-
createChoiceFormField
public static PdfChoiceFormField createChoiceFormField(PdfDocument document)
Create a minimal, emptyPdfChoiceFormField
using provided factory.- Parameters:
document
- ThePdfDocument
instance.- Returns:
- created
PdfChoiceFormField
-
createChoiceFormField
public static PdfChoiceFormField createChoiceFormField(PdfDictionary dictionary)
Creates a choice form field as a wrapper object around aPdfDictionary
using provided factory. ThisPdfDictionary
must be an indirect object.- Parameters:
dictionary
- the dictionary to be wrapped, must have an indirect reference.- Returns:
- created
PdfChoiceFormField
-
createChoiceFormField
public static PdfChoiceFormField createChoiceFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a choice form field as a parent of aPdfWidgetAnnotation
using provided factory.- Parameters:
widget
- The widget which will be a kid of thePdfChoiceFormField
.document
- ThePdfDocument
instance.- Returns:
- created
PdfChoiceFormField
-
createSignatureFormField
public static PdfSignatureFormField createSignatureFormField(PdfDocument document)
Create a minimal, emptyPdfSignatureFormField
using provided factory.- Parameters:
document
- ThePdfDocument
instance.- Returns:
- created
PdfSignatureFormField
-
createSignatureFormField
public static PdfSignatureFormField createSignatureFormField(PdfDictionary dictionary)
Creates a signature form field as a wrapper object around aPdfDictionary
using provided factory. ThisPdfDictionary
must be an indirect object.- Parameters:
dictionary
- the dictionary to be wrapped, must have an indirect reference.- Returns:
- created
PdfSignatureFormField
-
createSignatureFormField
public static PdfSignatureFormField createSignatureFormField(PdfWidgetAnnotation widget, PdfDocument document)
Creates a signature form field as a parent of aPdfWidgetAnnotation
using provided factory.- Parameters:
widget
- The widget which will be a kid of thePdfSignatureFormField
.document
- ThePdfDocument
instance.- Returns:
- created
PdfSignatureFormField
-
createFormAnnotation
public static PdfFormAnnotation createFormAnnotation(PdfDictionary dictionary)
Creates a form field annotation as a wrapper object around aPdfDictionary
using provided factory. ThisPdfDictionary
must be an indirect object.- Parameters:
dictionary
- the dictionary to be wrapped, must have an indirect reference.- Returns:
- created
PdfFormAnnotation
-
createFormAnnotation
public static PdfFormAnnotation createFormAnnotation(PdfWidgetAnnotation widget, PdfDocument document)
Creates a form field annotation as a wrapper of aPdfWidgetAnnotation
using provided factory.- Parameters:
widget
- The widget which will be a kid of thePdfFormField
document
- ThePdfDocument
instance.- Returns:
- created
PdfFormAnnotation
-
getAcroForm
public static PdfAcroForm getAcroForm(PdfDocument document, boolean createIfNotExist)
Retrieves AcroForm from the document using provided factory. If there is no AcroForm in the document Catalog and createIfNotExist flag is true then the AcroForm dictionary will be created and added to the document.- Parameters:
document
- the document to retrieve thePdfAcroForm
fromcreateIfNotExist
- whentrue
, this method will create aPdfAcroForm
if none exists for this document- Returns:
- the
document
's AcroForm, or a new one provided thatcreateIfNotExist
parameter istrue
, otherwisenull
.
-
-