Package com.itextpdf.forms.fields
Class PdfFormCreator
java.lang.Object
com.itextpdf.forms.fields.PdfFormCreator
Creator which shall be used in order to create all form related instances. By default
PdfFormFactory is used.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PdfButtonFormFieldcreateButtonFormField(PdfWidgetAnnotation widget, PdfDocument document) Creates a button form field as a parent of aPdfWidgetAnnotationusing provided factory.static PdfButtonFormFieldcreateButtonFormField(PdfDictionary dictionary) Creates a button form field as a wrapper object around aPdfDictionaryusing provided factory.static PdfButtonFormFieldcreateButtonFormField(PdfDocument document) Create a minimal, emptyPdfButtonFormFieldusing provided factory.static PdfChoiceFormFieldcreateChoiceFormField(PdfWidgetAnnotation widget, PdfDocument document) Creates a choice form field as a parent of aPdfWidgetAnnotationusing provided factory.static PdfChoiceFormFieldcreateChoiceFormField(PdfDictionary dictionary) Creates a choice form field as a wrapper object around aPdfDictionaryusing provided factory.static PdfChoiceFormFieldcreateChoiceFormField(PdfDocument document) Create a minimal, emptyPdfChoiceFormFieldusing provided factory.static PdfFormAnnotationcreateFormAnnotation(PdfWidgetAnnotation widget, PdfDocument document) Creates a form field annotation as a wrapper of aPdfWidgetAnnotationusing provided factory.static PdfFormAnnotationcreateFormAnnotation(PdfDictionary dictionary) Creates a form field annotation as a wrapper object around aPdfDictionaryusing provided factory.static PdfFormFieldcreateFormField(PdfWidgetAnnotation widget, PdfDocument document) Creates a form field as a parent of aPdfWidgetAnnotationusing provided factory.static PdfFormFieldcreateFormField(PdfDictionary dictionary) Creates a form field as a wrapper object around aPdfDictionaryusing provided factory.static PdfFormFieldcreateFormField(PdfDocument document) Create a minimal, emptyPdfFormFieldusing provided factory.static PdfSignatureFormFieldcreateSignatureFormField(PdfWidgetAnnotation widget, PdfDocument document) Creates a signature form field as a parent of aPdfWidgetAnnotationusing provided factory.static PdfSignatureFormFieldcreateSignatureFormField(PdfDictionary dictionary) Creates a signature form field as a wrapper object around aPdfDictionaryusing provided factory.static PdfSignatureFormFieldcreateSignatureFormField(PdfDocument document) Create a minimal, emptyPdfSignatureFormFieldusing provided factory.static PdfTextFormFieldcreateTextFormField(PdfWidgetAnnotation widget, PdfDocument document) Creates a text form field as a parent of aPdfWidgetAnnotationusing provided factory.static PdfTextFormFieldcreateTextFormField(PdfDictionary dictionary) Creates a text form field as a wrapper object around aPdfDictionaryusing provided factory.static PdfTextFormFieldcreateTextFormField(PdfDocument document) Create a minimal, emptyPdfTextFormFieldusing provided factory.static PdfAcroFormgetAcroForm(PdfDocument document, boolean createIfNotExist) Retrieves AcroForm from the document using provided factory.static voidsetFactory(PdfFormFactory factory) SetPdfFormFactoryto be used for form related instances creation.
-
Method Details
-
setFactory
SetPdfFormFactoryto be used for form related instances creation.- Parameters:
-
factory-PdfFormFactoryto set
-
createFormField
Create a minimal, emptyPdfFormFieldusing provided factory.- Parameters:
-
document- ThePdfDocumentinstance. - Returns:
-
created
PdfFormField
-
createFormField
Creates a form field as a wrapper object around aPdfDictionaryusing provided factory. ThisPdfDictionarymust be an indirect object.- Parameters:
-
dictionary- the dictionary to be wrapped, must have an indirect reference. - Returns:
-
created
PdfFormField
-
createFormField
Creates a form field as a parent of aPdfWidgetAnnotationusing provided factory.- Parameters:
-
widget- The widget which will be a kid of thePdfFormField. -
document- ThePdfDocumentinstance. - Returns:
-
created
PdfFormField
-
createTextFormField
Create a minimal, emptyPdfTextFormFieldusing provided factory.- Parameters:
-
document- ThePdfDocumentinstance. - Returns:
-
created
PdfTextFormField
-
createTextFormField
Creates a text form field as a wrapper object around aPdfDictionaryusing provided factory. ThisPdfDictionarymust 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 aPdfWidgetAnnotationusing provided factory.- Parameters:
-
widget- The widget which will be a kid of thePdfTextFormField. -
document- ThePdfDocumentinstance. - Returns:
-
created
PdfTextFormField
-
createButtonFormField
Create a minimal, emptyPdfButtonFormFieldusing provided factory.- Parameters:
-
document- ThePdfDocumentinstance. - Returns:
-
created
PdfButtonFormField
-
createButtonFormField
Creates a button form field as a wrapper object around aPdfDictionaryusing provided factory. ThisPdfDictionarymust 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 aPdfWidgetAnnotationusing provided factory.- Parameters:
-
widget- The widget which will be a kid of thePdfButtonFormField. -
document- ThePdfDocumentinstance. - Returns:
-
created
PdfButtonFormField
-
createChoiceFormField
Create a minimal, emptyPdfChoiceFormFieldusing provided factory.- Parameters:
-
document- ThePdfDocumentinstance. - Returns:
-
created
PdfChoiceFormField
-
createChoiceFormField
Creates a choice form field as a wrapper object around aPdfDictionaryusing provided factory. ThisPdfDictionarymust 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 aPdfWidgetAnnotationusing provided factory.- Parameters:
-
widget- The widget which will be a kid of thePdfChoiceFormField. -
document- ThePdfDocumentinstance. - Returns:
-
created
PdfChoiceFormField
-
createSignatureFormField
Create a minimal, emptyPdfSignatureFormFieldusing provided factory.- Parameters:
-
document- ThePdfDocumentinstance. - Returns:
-
created
PdfSignatureFormField
-
createSignatureFormField
Creates a signature form field as a wrapper object around aPdfDictionaryusing provided factory. ThisPdfDictionarymust 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 aPdfWidgetAnnotationusing provided factory.- Parameters:
-
widget- The widget which will be a kid of thePdfSignatureFormField. -
document- ThePdfDocumentinstance. - Returns:
-
created
PdfSignatureFormField
-
createFormAnnotation
Creates a form field annotation as a wrapper object around aPdfDictionaryusing provided factory. ThisPdfDictionarymust 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 aPdfWidgetAnnotationusing provided factory.- Parameters:
-
widget- The widget which will be a kid of thePdfFormField -
document- ThePdfDocumentinstance. - Returns:
-
created
PdfFormAnnotation
-
getAcroForm
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 thePdfAcroFormfrom -
createIfNotExist- whentrue, this method will create aPdfAcroFormif none exists for this document - Returns:
-
the
document's AcroForm, or a new one provided thatcreateIfNotExistparameter istrue, otherwisenull.
-