Package com.itextpdf.forms.fields
Class PdfFormCreator
- java.lang.Object
-
- com.itextpdf.forms.fields.PdfFormCreator
-
public final class PdfFormCreator extends java.lang.ObjectCreator which shall be used in order to create all form related instances. By defaultPdfFormFactoryis used.
-
-
Field Summary
Fields Modifier and Type Field Description private static PdfFormFactoryfactory
-
Constructor Summary
Constructors Modifier Constructor Description privatePdfFormCreator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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.
-
-
-
Field Detail
-
factory
private static PdfFormFactory factory
-
-
Method Detail
-
setFactory
public static void setFactory(PdfFormFactory factory)
SetPdfFormFactoryto be used for form related instances creation.- Parameters:
factory-PdfFormFactoryto set
-
createFormField
public static PdfFormField createFormField(PdfDocument document)
Create a minimal, emptyPdfFormFieldusing provided factory.- Parameters:
document- ThePdfDocumentinstance.- Returns:
- created
PdfFormField
-
createFormField
public static PdfFormField createFormField(PdfDictionary dictionary)
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
public static PdfFormField createFormField(PdfWidgetAnnotation widget, PdfDocument document)
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
public static PdfTextFormField createTextFormField(PdfDocument document)
Create a minimal, emptyPdfTextFormFieldusing provided factory.- Parameters:
document- ThePdfDocumentinstance.- Returns:
- created
PdfTextFormField
-
createTextFormField
public static PdfTextFormField createTextFormField(PdfDictionary dictionary)
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
public static PdfButtonFormField createButtonFormField(PdfDocument document)
Create a minimal, emptyPdfButtonFormFieldusing provided factory.- Parameters:
document- ThePdfDocumentinstance.- Returns:
- created
PdfButtonFormField
-
createButtonFormField
public static PdfButtonFormField createButtonFormField(PdfDictionary dictionary)
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
public static PdfChoiceFormField createChoiceFormField(PdfDocument document)
Create a minimal, emptyPdfChoiceFormFieldusing provided factory.- Parameters:
document- ThePdfDocumentinstance.- Returns:
- created
PdfChoiceFormField
-
createChoiceFormField
public static PdfChoiceFormField createChoiceFormField(PdfDictionary dictionary)
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
public static PdfSignatureFormField createSignatureFormField(PdfDocument document)
Create a minimal, emptyPdfSignatureFormFieldusing provided factory.- Parameters:
document- ThePdfDocumentinstance.- Returns:
- created
PdfSignatureFormField
-
createSignatureFormField
public static PdfSignatureFormField createSignatureFormField(PdfDictionary dictionary)
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
public static PdfFormAnnotation createFormAnnotation(PdfDictionary dictionary)
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 thePdfFormFielddocument- ThePdfDocumentinstance.- 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 thePdfAcroFormfromcreateIfNotExist- whentrue, this method will create aPdfAcroFormif none exists for this document- Returns:
- the
document's AcroForm, or a new one provided thatcreateIfNotExistparameter istrue, otherwisenull.
-
-