Form
Inheritance: java.lang.Object, com.aspose.pdf.Form
All Implemented Interfaces: Iterable < WidgetAnnotation >
public final class Form extends Object implements Iterable < WidgetAnnotation >
Class representing form object.
Constructors
| Constructor | Description |
|---|---|
| Form | Constructor |
Methods
| Method | Description |
|---|---|
| add | Adds field on the form. |
| add | Adds field on the form. |
| add | Adds new field to the form; If this field is already placed on other or this form, the copy of field is created. |
| add | Adds field on the form. |
| addFieldAppearance | Adds additional appearance of the field to specified page of the document in the specified location. |
| addFieldToAcroForm | Adds additional appearance of the field to specified page of the document. |
| assignXfa | Sets XFA of the form to specified value. |
| clear | Deletes all fields from form. Not supported. |
| contains | Determines if field is presented on form.. |
| copyTo | Copies fields placed on the form into array. |
| copyTo | Copies form’s fields to array. |
| delete | Delete field from the form. |
| delete | Deletes field from the form by its name. |
| flatten | Removes all static form fields and place their values directly on the page. |
| get_Item | Gets field of the form by field index. |
| get_Item | Gets field of the form by field name. Throws excpetion if the field was not found. |
| get_xfa | For internal usage only |
| get | |
| get | Searches field by field name. Returns null if field was not found. |
| getAutoRecalculate | If set, all form fields will be recalculated when any field is changed. Default value is true. Set to false in order to increase performance when filling form with large amount of calculated fields. |
| getAutoRestoreForm | If set, absent form fields will be automatically created if they present in annotations. |
| getDefaultAppearance | Gets default appearance of the form (object which describes default font, text size and color for fields on the form). |
| getDefaultResources | Gets default resources placed on this form. |
| getDocument | For internal usage only |
| getEmulateRequierdGroups | If this property is true then additional red boundary rectangles will be drawn for required Xfa exclGroup elements containers This property was introduced because absences of analogies for the exclGroup during conversion Xfa representation of forms to standard. It is false by default. |
| getFields | Gets list of all fields in lowest level of hierarhical form. |
| getFieldsInRect | Returns fields inside of specified rectangle. |
| getIgnoreNeedsRendering | If this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form. It is false by default. |
| getNeedsRendering | Gets a value indicating whether the document requires the removal of the dynamic XFA form. This property was introduced to determine if {@code IgnoreNeedsRendering}({@link #getIgnoreNeedsRendering}/{@link #setIgnoreNeedsRendering(boolean)}) should be used to remove the XFA form in cases where the XFA form is present and {@code NeedsRendering}({@link #getNeedsRendering}) is false. |
| getRemovePermission | If this property is true the “Perms” dictionary will be removed from the pdf document after conversion dynamic documents to standard. The “Perms” dictionary can contain a rules that disturb displaying selection of mandatory fields in Adobe Acrobat reader. It is false by default. |
| getSignaturesAppendOnly | 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. |
| getSignaturesExist | If set, the document contains at least one signature field. |
| getSignDependentElementsRenderingModeWhenConverted | Forms can contain signing information, i.e. can be signed or unsigned. And form’s view sometimes must depend on whether form is signed or not. This property tells to form’s converter (f.e. during conversion XFA form to Standard form) whether result form must be rendered as signed or as unsigned. |
| getSyncRoot | Returns synchronization object. |
| getType | Gets type of the form. Possible values are: Standard, Static, Dynamic. |
| getXFA | Gets XFA data of the form (if presents). |
| hasField | Check if the form already has specified field. |
| hasField | Determines if the field with specified name already added to the Form. |
| hasField | Determines if the field with specified name already added to the Form, with ability to look into children hierarchy of fields. |
| hasXfa | Gets a value indicating whether the document contains XFA form. This property was introduced to determine if {@code IgnoreNeedsRendering}({@link #getIgnoreNeedsRendering}/{@link #setIgnoreNeedsRendering(boolean)}) should be used to remove the XFA form in cases where the XFA form is present and {@code NeedsRendering}({@link #getNeedsRendering}) is false. |
| isReadOnly | Determines if collection is readonly. Always returns false. |
| isSynchronized | Returns true if object is thread-safe. |
| iterator | Gets enumeration of form fields. |
| makeFormAnnotationsIndependent | / * / * Exports the PDF form fields to JSON format and writes the result to the provided stream. / * / * Document document = new Document(“PdfDoc.pdf”); / * FileStream fs = new FileStream(“export.json”, FileMode.Create, FileAccess.Write); / * document.Form.ExportFormFieldsToJson(fs); / * fs.Close(); / * |
| remove | Deletes field from the form. |
| removeFieldAppearance | Removes appearance of the field at specified index. If only one child appearance left, method embeds it into the field. |
| setAutoRecalculate | If set, all form fields will be recalculated when any field is changed. Default value is true. Set to false in order to increase performance when filling form with large amount of calculated fields. |
| setAutoRestoreForm | If set, absent form fields will be automatically created if they present in annotations. |
| setCalculatedFields | Allows to set order of field calculation. |
| setDefaultAppearance | Sets default appearance of the form (object which describes default font, text size and color for fields on the form). |
| setEmulateRequierdGroups | If this property is true then additional red boundary rectangles will be drawn for required Xfa exclGroup elements containers This property was introduced because absences of analogies for the exclGroup during conversion Xfa representation of forms to standard. It is false by default. |
| setIgnoreNeedsRendering | If this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form. It is false by default. |
| setRemovePermission | If this property is true the “Perms” dictionary will be removed from the pdf document after conversion dynamic documents to standard. The “Perms” dictionary can contain a rules that disturb displaying selection of mandatory fields in Adobe Acrobat reader. It is false by default. |
| setSignaturesAppendOnly | 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. |
| setSignaturesExist | If set, the document contains at least one signature field. |
| setSignDependentElementsRenderingModeWhenConverted | Forms can contain signing information, i.e. can be signed or unsigned. And form’s view sometimes must depend on whether form is signed or not. This property tells to form’s converter (f.e. during conversion XFA form to Standard form) whether result form must be rendered as signed or as unsigned. |
| setType | Gets type of the form. Possible values are: Standard, Static, Dynamic. |
| size | Gets number of the fields on this form. |
Form
Constructor
add
Adds field on the form.
add
Adds field on the form.
add
Adds new field to the form; If this field is already placed on other or this form, the copy of field is created.
add
Adds field on the form.
addFieldAppearance
Adds additional appearance of the field to specified page of the document in the specified location.
addFieldToAcroForm
Adds additional appearance of the field to specified page of the document.
assignXfa
Sets XFA of the form to specified value.
clear
public void clear()
Deletes all fields from form. Not supported.
contains
Determines if field is presented on form..
copyTo
Copies fields placed on the form into array.
copyTo
Copies form’s fields to array.
delete
Delete field from the form.
delete
Deletes field from the form by its name.
flatten
public void flatten()
Removes all static form fields and place their values directly on the page.
get_Item
public WidgetAnnotation get_Item(int index)
Gets field of the form by field index.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| index | Index of the field. |
Returns: Retreived field.
get_Item
Gets field of the form by field name. Throws excpetion if the field was not found.
get_xfa
public XFA get_xfa()
For internal usage only
Returns: XFA object
get
public WidgetAnnotation get(int index)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| index |
get
Searches field by field name. Returns null if field was not found.
getAutoRecalculate
public final boolean getAutoRecalculate()
If set, all form fields will be recalculated when any field is changed. Default value is true. Set to false in order to increase performance when filling form with large amount of calculated fields.
Returns: boolean value
getAutoRestoreForm
public final boolean getAutoRestoreForm()
If set, absent form fields will be automatically created if they present in annotations.
Returns: boolean value
getDefaultAppearance
public DefaultAppearance getDefaultAppearance()
Gets default appearance of the form (object which describes default font, text size and color for fields on the form).
Returns: DefaultAppearance object
getDefaultResources
public Resources getDefaultResources()
Gets default resources placed on this form.
Returns: Resources value
getDocument
public IDocument getDocument()
For internal usage only
Returns: IDocument object
getEmulateRequierdGroups
public boolean getEmulateRequierdGroups()
If this property is true then additional red boundary rectangles will be drawn for required Xfa exclGroup elements containers This property was introduced because absences of analogies for the exclGroup during conversion Xfa representation of forms to standard. It is false by default.
Returns: boolean value
getFields
public Field [] getFields()
Gets list of all fields in lowest level of hierarhical form.
Returns: Array with found fields.
getFieldsInRect
Returns fields inside of specified rectangle.
getIgnoreNeedsRendering
public boolean getIgnoreNeedsRendering()
If this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form. It is false by default.
Returns: boolean value
getNeedsRendering
public final boolean getNeedsRendering()
Gets a value indicating whether the document requires the removal of the dynamic XFA form. This property was introduced to determine if {@code IgnoreNeedsRendering}({@link #getIgnoreNeedsRendering}/{@link #setIgnoreNeedsRendering(boolean)}) should be used to remove the XFA form in cases where the XFA form is present and {@code NeedsRendering}({@link #getNeedsRendering}) is false.
Returns: boolean value
getRemovePermission
public boolean getRemovePermission()
If this property is true the “Perms” dictionary will be removed from the pdf document after conversion dynamic documents to standard. The “Perms” dictionary can contain a rules that disturb displaying selection of mandatory fields in Adobe Acrobat reader. It is false by default.
Returns: boolean value
getSignaturesAppendOnly
public final boolean getSignaturesAppendOnly()
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.
Returns: boolean value
getSignaturesExist
public final boolean getSignaturesExist()
If set, the document contains at least one signature field.
Returns: boolean value
getSignDependentElementsRenderingModeWhenConverted
public int getSignDependentElementsRenderingModeWhenConverted()
Forms can contain signing information, i.e. can be signed or unsigned. And form’s view sometimes must depend on whether form is signed or not. This property tells to form’s converter (f.e. during conversion XFA form to Standard form) whether result form must be rendered as signed or as unsigned.
Returns: SignDependentElementsRenderingModes element @see SignDependentElementsRenderingModes
getSyncRoot
public Object getSyncRoot()
Returns synchronization object.
Returns: Object for synchronization
getType
public FormType getType()
Gets type of the form. Possible values are: Standard, Static, Dynamic.
Returns: FormType value @see FormType
getXFA
public XFA getXFA()
Gets XFA data of the form (if presents).
Returns: XFA value
hasField
Check if the form already has specified field.
hasField
Determines if the field with specified name already added to the Form.
hasField
Determines if the field with specified name already added to the Form, with ability to look into children hierarchy of fields.
hasXfa
public final boolean hasXfa()
Gets a value indicating whether the document contains XFA form. This property was introduced to determine if {@code IgnoreNeedsRendering}({@link #getIgnoreNeedsRendering}/{@link #setIgnoreNeedsRendering(boolean)}) should be used to remove the XFA form in cases where the XFA form is present and {@code NeedsRendering}({@link #getNeedsRendering}) is false.
Returns: boolean value
isReadOnly
public boolean isReadOnly()
Determines if collection is readonly. Always returns false.
Returns: boolean value
isSynchronized
public boolean isSynchronized()
Returns true if object is thread-safe.
Returns: boolean value
iterator
public com.aspose.ms.System.Collections.Generic.List.Enumerator< WidgetAnnotation > iterator()
Gets enumeration of form fields.
Returns: Field enumerator.
makeFormAnnotationsIndependent
/ * / * Exports the PDF form fields to JSON format and writes the result to the provided stream. / * / * Document document = new Document(“PdfDoc.pdf”); / * FileStream fs = new FileStream(“export.json”, FileMode.Create, FileAccess.Write); / * document.Form.ExportFormFieldsToJson(fs); / * fs.Close(); / *
remove
Deletes field from the form.
removeFieldAppearance
Removes appearance of the field at specified index. If only one child appearance left, method embeds it into the field.
setAutoRecalculate
public final void setAutoRecalculate(boolean value)
If set, all form fields will be recalculated when any field is changed. Default value is true. Set to false in order to increase performance when filling form with large amount of calculated fields.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setAutoRestoreForm
public final void setAutoRestoreForm(boolean value)
If set, absent form fields will be automatically created if they present in annotations.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setCalculatedFields
Allows to set order of field calculation.
setDefaultAppearance
Sets default appearance of the form (object which describes default font, text size and color for fields on the form).
setEmulateRequierdGroups
public void setEmulateRequierdGroups(boolean value)
If this property is true then additional red boundary rectangles will be drawn for required Xfa exclGroup elements containers This property was introduced because absences of analogies for the exclGroup during conversion Xfa representation of forms to standard. It is false by default.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setIgnoreNeedsRendering
public void setIgnoreNeedsRendering(boolean value)
If this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form. It is false by default.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setRemovePermission
public void setRemovePermission(boolean value)
If this property is true the “Perms” dictionary will be removed from the pdf document after conversion dynamic documents to standard. The “Perms” dictionary can contain a rules that disturb displaying selection of mandatory fields in Adobe Acrobat reader. It is false by default.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setSignaturesAppendOnly
public final void setSignaturesAppendOnly(boolean value)
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.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setSignaturesExist
public final void setSignaturesExist(boolean value)
If set, the document contains at least one signature field.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | boolean value |
setSignDependentElementsRenderingModeWhenConverted
public void setSignDependentElementsRenderingModeWhenConverted(int signDependentElementsRenderingModeWhenConverted)
Forms can contain signing information, i.e. can be signed or unsigned. And form’s view sometimes must depend on whether form is signed or not. This property tells to form’s converter (f.e. during conversion XFA form to Standard form) whether result form must be rendered as signed or as unsigned.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| signDependentElementsRenderingModeWhenConverted | SignDependentElementsRenderingModes element @see SignDependentElementsRenderingModes |
setType
Gets type of the form. Possible values are: Standard, Static, Dynamic.
size
public final int size()
Gets number of the fields on this form.
Returns: int value