iText 9.1.0 API
|
This class represents the static form technology AcroForm on a PDF file. More...
Public Member Functions |
|
virtual void | AddField (PdfFormField field) |
This method adds the field to the last page in the document. More... |
|
virtual void | AddField (PdfFormField field, PdfPage page) |
This method adds the field to a specific page. More... |
|
virtual void | AddField (PdfFormField field, PdfPage page, bool throwExceptionOnError) |
This method adds the field to a specific page. More... |
|
virtual void | AddFieldAppearanceToPage (PdfFormField field, PdfPage page) |
This method merges field with its annotation and places it on the given page. More... |
|
virtual IDictionary< String, PdfFormField > | GetRootFormFields () |
Gets root fields (i.e. direct children of Acroform dictionary). More... |
|
virtual IDictionary< String, PdfFormField > | GetAllFormFields () |
Gets all form field s as a System.Collections.IDictionary |
|
virtual ICollection< AbstractPdfFormField > | GetAllFormFieldsAndAnnotations () |
Gets all form field s as a Java.Util.Set |
|
virtual ICollection< PdfFormField > | GetFieldsForFlattening () |
Gets a collection of form field s, prepared for flattening using PartialFormFlattening(System.String) method. More... |
|
virtual PdfDocument | GetPdfDocument () |
Gets the iText.Kernel.Pdf.PdfDocument this PdfAcroForm belongs to. More... |
|
virtual iText.Forms.PdfAcroForm | SetNeedAppearances (bool needAppearances) |
Sets the NeedAppearances boolean property on the AcroForm. More... |
|
virtual PdfBoolean | GetNeedAppearances () |
Gets the NeedAppearances boolean property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetSignatureFlags (int sigFlags) |
Sets the SigFlags integer property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetSignatureFlag (int sigFlag) |
Changes the SigFlags integer property on the AcroForm. More... |
|
virtual int | GetSignatureFlags () |
Gets the SigFlags integer property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetCalculationOrder (PdfArray calculationOrder) |
Sets the CO array property on the AcroForm. More... |
|
virtual PdfArray | GetCalculationOrder () |
Gets the CO array property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetDefaultResources (PdfDictionary defaultResources) |
Sets the DR dictionary property on the AcroForm. More... |
|
virtual PdfDictionary | GetDefaultResources () |
Gets the DR dictionary property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetDefaultAppearance (String appearance) |
Sets the DA String property on the AcroForm. More... |
|
virtual PdfString | GetDefaultAppearance () |
Gets the DA String property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetDefaultJustification (int justification) |
Sets the Q integer property on the AcroForm. More... |
|
virtual PdfNumber | GetDefaultJustification () |
Gets the Q integer property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetXFAResource (PdfStream xfaResource) |
Sets the XFA property on the AcroForm. More... |
|
virtual iText.Forms.PdfAcroForm | SetXFAResource (PdfArray xfaResource) |
Sets the XFA property on the AcroForm. More... |
|
virtual PdfObject | GetXFAResource () |
Gets the XFA property on the AcroForm. More... |
|
virtual PdfFormField | GetField (String fieldName) |
Gets a form field by its name. More... |
|
virtual bool | IsGenerateAppearance () |
Gets the attribute generateAppearance, which tells FlattenFields() to generate an appearance Stream for all form field s that don't have one. More... |
|
virtual void | SetGenerateAppearance (bool generateAppearance) |
Sets the attribute generateAppearance, which tells FlattenFields() to generate an appearance Stream for all form field s that don't have one. More... |
|
virtual void | FlattenFields () |
Flattens interactive form field s in the document. More... |
|
virtual bool | RemoveField (String fieldName) |
Tries to remove the form field with the specified name from the document. More... |
|
virtual void | PartialFormFlattening (String fieldName) |
Adds a form field , identified by name, to the list of fields to be flattened. More... |
|
virtual void | RenameField (String oldName, String newName) |
Changes the identifier of a form field. More... |
|
virtual PdfFormField | CopyField (String name) |
Creates an in-memory copy of a iText.Forms.Fields.PdfFormField. More... |
|
virtual void | ReplaceField (String name, PdfFormField field) |
Replaces the iText.Forms.Fields.PdfFormField of a certain name with another iText.Forms.Fields.PdfFormField. More... |
|
virtual void | DisableRegenerationForAllFields () |
Disables appearance stream regeneration for all the root fields in the Acroform, so all of its children in the hierarchy will also not be regenerated. More... |
|
virtual void | EnableRegenerationForAllFields () |
Enables appearance stream regeneration for all the fields in the Acroform and regenerates them. More... |
|
virtual bool | HasXfaForm () |
Determines whether the AcroForm contains XFA data. More... |
|
virtual XfaForm | GetXfaForm () |
Gets the iText.Forms.Xfa.XfaForm atribute. More... |
|
virtual void | RemoveXfaForm () |
Removes the XFA stream from the document. More... |
|
virtual iText.Forms.PdfAcroForm | Put (PdfName key, PdfObject value) |
Put a key/value pair in the dictionary and overwrite previous value if it already exists. More... |
|
virtual void | Release () |
Releases underlying pdf object and other pdf entities used by wrapper. More... |
|
override PdfObjectWrapper< PdfDictionary > | SetModified () |
![]() |
|
virtual T | GetPdfObject () |
virtual iText.Kernel.Pdf.PdfObjectWrapper< T > | MakeIndirect (PdfDocument document, PdfIndirectReference reference) |
Marks object behind wrapper to be saved as indirect. More... |
|
virtual iText.Kernel.Pdf.PdfObjectWrapper< T > | MakeIndirect (PdfDocument document) |
Marks object behind wrapper to be saved as indirect. More... |
|
virtual void | Flush () |
virtual bool | IsFlushed () |
Static Public Member Functions |
|
static iText.Forms.PdfAcroForm | GetAcroForm (PdfDocument document, bool createIfNotExist) |
Retrieves AcroForm from the document. More... |
|
static iText.Forms.PdfAcroForm | GetAcroForm (PdfDocument document, bool createIfNotExist, OnDuplicateFormFieldNameStrategy onDuplicateFieldNameStrategy) |
Retrieves AcroForm from the document. More... |
|
Static Public Attributes |
|
const int | SIGNATURE_EXIST = 1 |
To be used with SetSignatureFlags(int). More... |
|
const int | APPEND_ONLY = 2 |
To be used with SetSignatureFlags(int). More... |
|
Protected Member Functions |
|
override bool | IsWrappedObjectMustBeIndirect () |
Defines if the object behind this wrapper must be an indirect object in the resultant document. More... |
|
Package Functions |
|
virtual PdfArray | GetFields () |
Gets all AcroForm fields in the document. More... |
|
![]() |
|
PdfObjectWrapper (T pdfObject) | |
virtual void | SetPdfObject (T pdfObject) |
virtual void | SetForbidRelease () |
virtual void | UnsetForbidRelease () |
virtual void | EnsureUnderlyingObjectHasIndirectReference () |
Package Attributes |
|
bool | generateAppearance = true |
Keeps track of whether or not appearances must be generated by the form fields themselves, or by the PDF viewer application. More... |
|
IDictionary< String, PdfFormField > | fields = new LinkedDictionary |
A map of field names and their associated form field objects. More... |
|
PdfDocument | document |
The PdfDocument to which the PdfAcroForm belongs. More... |
|
Additional Inherited Members |
|
![]() |
|
static void | MarkObjectAsIndirect (PdfObject pdfObject) |
static void | EnsureObjectIsAddedToDocument (PdfObject @object) |
Some wrappers use object's indirect reference to obtain the PdfDocument to which the object belongs to. More... |
|
This class represents the static form technology AcroForm on a PDF file.
|
inlinevirtual |
This method adds the field to the last page in the document.
This method adds the field to the last page in the document. If there's no pages, creates a new one.
field | the iText.Forms.Fields.PdfFormField to be added to the form |
|
inlinevirtual |
This method adds the field to a specific page.
field | the iText.Forms.Fields.PdfFormField to be added to the form |
page | the iText.Kernel.Pdf.PdfPage on which to add the field |
|
inlinevirtual |
This method adds the field to a specific page.
field | the iText.Forms.Fields.PdfFormField to be added to the form |
page | the iText.Kernel.Pdf.PdfPage on which to add the field |
throwExceptionOnError | true if the exception is expected to be thrown in case of error. |
|
inlinevirtual |
This method merges field with its annotation and places it on the given page.
This method merges field with its annotation and places it on the given page. This method also work if the field has more than one widget annotation, but doesn't work with no annotations.
field | the iText.Forms.Fields.PdfFormField to be added to the form |
page | the iText.Kernel.Pdf.PdfPage on which to add the field |
|
inlinevirtual |
Creates an in-memory copy of a iText.Forms.Fields.PdfFormField.
Creates an in-memory copy of a iText.Forms.Fields.PdfFormField . This new field is not added to the document.
name | the name of the form field to be copied |
|
inlinevirtual |
Disables appearance stream regeneration for all the root fields in the Acroform, so all of its children in the hierarchy will also not be regenerated.
|
inlinevirtual |
Enables appearance stream regeneration for all the fields in the Acroform and regenerates them.
|
inlinevirtual |
Flattens interactive form field s in the document.
Flattens interactive form field s in the document. If no fields have been explicitly included via PartialFormFlattening(System.String) , then all fields are flattened. Otherwise only the included fields are flattened.
|
inlinestatic |
Retrieves AcroForm from the document.
Retrieves AcroForm from the document. 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.
document | the document to retrieve the PdfAcroForm from |
createIfNotExist | when true , this method will create a PdfAcroForm if none exists for this document |
createIfNotExist
parameter is true
, otherwise null
.
|
inlinestatic |
Retrieves AcroForm from the document.
Retrieves AcroForm from the document. 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.
document | the document to retrieve the PdfAcroForm from |
createIfNotExist | when true , this method will create a PdfAcroForm if none exists for this document |
onDuplicateFieldNameStrategy | the strategy to be used when a field with the same name already exists |
createIfNotExist
parameter is true
, otherwise null
.
|
inlinevirtual |
Gets all form field s as a System.Collections.IDictionary
|
inlinevirtual |
Gets all form field s as a Java.Util.Set
|
inlinevirtual |
Gets the CO
array property on the AcroForm.
Gets the CO
array property on the AcroForm.
CO
, Calculation Order, is an array of indirect references to field dictionaries with calculation actions, defining the calculation order in which their values will be recalculated when the value of any field changes (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
|
inlinevirtual |
Gets the DA
String property on the AcroForm.
Gets the DA
String property on the AcroForm.
This method returns the default (fallback value) for the DA
attribute of variable text form field s.
String
|
inlinevirtual |
Gets the Q
integer property on the AcroForm.
Gets the Q
integer property on the AcroForm.
This method gets the default (fallback value) for the Q
attribute of variable text form field s.
|
inlinevirtual |
Gets the DR
dictionary property on the AcroForm.
Gets the DR
dictionary property on the AcroForm.
DR
is a resource dictionary containing default resources (such as fonts, patterns, or colour spaces) that shall be used by form field appearance streams. At a minimum, this dictionary shall contain a Font entry specifying the resource name and font dictionary of the default font for displaying text. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
|
inlinevirtual |
Gets a form field by its name.
fieldName | the name of the form field to retrieve |
null
if it isn't present
|
inlinepackagevirtual |
Gets all AcroForm fields in the document.
|
inlinevirtual |
Gets a collection of form field s, prepared for flattening using PartialFormFlattening(System.String) method.
Gets a collection of form field s, prepared for flattening using PartialFormFlattening(System.String) method. If returned collection is empty, all form fields will be flattened on flattenFields call.
|
inlinevirtual |
Gets the NeedAppearances
boolean property on the AcroForm.
Gets the NeedAppearances
boolean property on the AcroForm. NeedAppearances has been deprecated in PDF 2.0.
NeedAppearances is a flag specifying whether to construct appearance streams and appearance dictionaries for all widget annotations in the document. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
NeedAppearances
property as a iText.Kernel.Pdf.PdfBoolean . Default value is false
|
inlinevirtual |
Gets the iText.Kernel.Pdf.PdfDocument this PdfAcroForm belongs to.
|
inlinevirtual |
Gets root fields (i.e. direct children of Acroform dictionary).
|
inlinevirtual |
Gets the SigFlags
integer property on the AcroForm.
Gets the SigFlags
integer property on the AcroForm.
SigFlags is a set of flags specifying various document-level characteristics related to signature fields (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
SigFlags
.
|
inlinevirtual |
Gets the iText.Forms.Xfa.XfaForm atribute.
|
inlinevirtual |
Gets the XFA
property on the AcroForm.
|
inlinevirtual |
Determines whether the AcroForm contains XFA data.
|
inlinevirtual |
Gets the attribute generateAppearance, which tells FlattenFields() to generate an appearance Stream for all form field s that don't have one.
|
inlineprotectedvirtual |
Defines if the object behind this wrapper must be an indirect object in the resultant document.
Defines if the object behind this wrapper must be an indirect object in the resultant document.
If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.
Return value of this method shouldn't depend on any logic, it should return always true or false.
Implements iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >.
|
inlinevirtual |
Adds a form field , identified by name, to the list of fields to be flattened.
Adds a form field , identified by name, to the list of fields to be flattened. Does not perform a flattening operation in itself.
fieldName | the name of the form field to be flattened |
|
inlinevirtual |
Put a key/value pair in the dictionary and overwrite previous value if it already exists.
key | the key as pdf name |
value | the value as pdf object |
|
inlinevirtual |
Releases underlying pdf object and other pdf entities used by wrapper.
Releases underlying pdf object and other pdf entities used by wrapper. This method should be called instead of direct call to iText.Kernel.Pdf.PdfObject.Release() if the wrapper is used.
|
inlinevirtual |
Tries to remove the form field with the specified name from the document.
fieldName | the name of the form field to remove |
|
inlinevirtual |
Removes the XFA stream from the document.
|
inlinevirtual |
Changes the identifier of a form field.
oldName | the current name of the field |
newName | the new name of the field. Must not be used currently. |
|
inlinevirtual |
Replaces the iText.Forms.Fields.PdfFormField of a certain name with another iText.Forms.Fields.PdfFormField.
name | the name of the form field to be replaced |
field | the new iText.Forms.Fields.PdfFormField |
|
inlinevirtual |
Sets the CO
array property on the AcroForm.
Sets the CO
array property on the AcroForm.
CO
, Calculation Order, is an array of indirect references to field dictionaries with calculation actions, defining the calculation order in which their values will be recalculated when the value of any field changes (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
calculationOrder | an array of indirect references |
|
inlinevirtual |
Sets the DA
String property on the AcroForm.
Sets the DA
String property on the AcroForm.
This method sets a default (fallback value) for the DA
attribute of variable text form field s.
appearance | a String containing a sequence of valid PDF syntax |
|
inlinevirtual |
Sets the Q
integer property on the AcroForm.
Sets the Q
integer property on the AcroForm.
This method sets a default (fallback value) for the Q
attribute of variable text form field s.
justification | an integer representing a justification value |
|
inlinevirtual |
Sets the DR
dictionary property on the AcroForm.
Sets the DR
dictionary property on the AcroForm.
DR
is a resource dictionary containing default resources (such as fonts, patterns, or colour spaces) that shall be used by form field appearance streams. At a minimum, this dictionary shall contain a Font entry specifying the resource name and font dictionary of the default font for displaying text. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
defaultResources | a resource dictionary |
|
inlinevirtual |
Sets the attribute generateAppearance, which tells FlattenFields() to generate an appearance Stream for all form field s that don't have one.
Sets the attribute generateAppearance, which tells FlattenFields() to generate an appearance Stream for all form field s that don't have one.
Not generating appearances will speed up form flattening but the results can be unexpected in Acrobat. Don't use it unless your environment is well controlled. The default is true
.
If generateAppearance is set to true
, then NeedAppearances
is set to false
. This does not apply vice versa.
Note, this method does not change default behaviour of iText.Forms.Fields.PdfFormField.SetValue(System.String) method.
generateAppearance | a boolean |
|
inlinevirtual |
Sets the NeedAppearances
boolean property on the AcroForm.
Sets the NeedAppearances
boolean property on the AcroForm. NeedAppearances has been deprecated in PDF 2.0.
NeedAppearances is a flag specifying whether to construct appearance streams and appearance dictionaries for all widget annotations in the document. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
needAppearances | a boolean. Default value is false |
|
inlinevirtual |
Changes the SigFlags
integer property on the AcroForm.
Changes the SigFlags
integer property on the AcroForm. This method allows only to add flags, not to remove them.
SigFlags is a set of flags specifying various document-level characteristics related to signature fields. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
sigFlag | an integer. Use SIGNATURE_EXIST and/or APPEND_ONLY. Use bitwise OR operator to combine these values. Default is 0 |
|
inlinevirtual |
Sets the SigFlags
integer property on the AcroForm.
Sets the SigFlags
integer property on the AcroForm.
SigFlags is a set of flags specifying various document-level characteristics related to signature fields. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
sigFlags | an integer. Use SIGNATURE_EXIST and/or APPEND_ONLY. Use bitwise OR operator to combine these values. Default value is 0 |
|
inlinevirtual |
Sets the XFA
property on the AcroForm.
Sets the XFA
property on the AcroForm.
XFA
can either be a iText.Kernel.Pdf.PdfStream or a iText.Kernel.Pdf.PdfArray. Its contents must be valid XFA.
xfaResource | an array of text string and stream pairs representing the individual packets comprising the XML Data Package. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary") |
|
inlinevirtual |
Sets the XFA
property on the AcroForm.
Sets the XFA
property on the AcroForm.
XFA
can either be a iText.Kernel.Pdf.PdfStream or a iText.Kernel.Pdf.PdfArray. Its contents must be valid XFA.
xfaResource | a stream containing the XDP |
|
static |
To be used with SetSignatureFlags(int).
To be used with SetSignatureFlags(int).
If set, the document contains signatures that may be invalidated if the file is saved (written) in a way that alters its previous contents, as opposed to an incremental update. Merely updating the file by appending new information to the end of the previous version is safe. Conforming readers may use this flag to inform a user requesting a full save that signatures will be invalidated and require explicit confirmation before continuing with the operation. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")
|
package |
The PdfDocument to which the PdfAcroForm belongs.
|
package |
A map of field names and their associated form field objects.
|
package |
Keeps track of whether or not appearances must be generated by the form fields themselves, or by the PDF viewer application.
Keeps track of whether or not appearances must be generated by the form fields themselves, or by the PDF viewer application. Default is true
.
|
static |
To be used with SetSignatureFlags(int).
To be used with SetSignatureFlags(int).
If set, the document contains at least one signature field. This flag allows a conforming reader to enable user interface items (such as menu items or pushbuttons) related to signature processing without having to scan the entire document for the presence of signature fields. (ISO 32000-1, section 12.7.2 "Interactive Form Dictionary")