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 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.
-
Method Details
-
setFactory
SetPdfFormFactory
to be used for form related instances creation.- Parameters:
-
factory
-PdfFormFactory
to set
-
createFormField
Create a minimal, emptyPdfFormField
using provided factory.- Parameters:
-
document
- ThePdfDocument
instance. - Returns:
-
created
PdfFormField
-
createFormField
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
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
Create a minimal, emptyPdfTextFormField
using provided factory.- Parameters:
-
document
- ThePdfDocument
instance. - Returns:
-
created
PdfTextFormField
-
createTextFormField
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
Create a minimal, emptyPdfButtonFormField
using provided factory.- Parameters:
-
document
- ThePdfDocument
instance. - Returns:
-
created
PdfButtonFormField
-
createButtonFormField
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
Create a minimal, emptyPdfChoiceFormField
using provided factory.- Parameters:
-
document
- ThePdfDocument
instance. - Returns:
-
created
PdfChoiceFormField
-
createChoiceFormField
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
Create a minimal, emptyPdfSignatureFormField
using provided factory.- Parameters:
-
document
- ThePdfDocument
instance. - Returns:
-
created
PdfSignatureFormField
-
createSignatureFormField
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
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
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
from -
createIfNotExist
- 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
.
-