Form

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public final class Form implements Iterable<WidgetAnnotation>

Class representing form object.

Constructors

Constructor Description
Form(IDocument document) Constructor

Methods

Method Description
getSignDependentElementsRenderingModeWhenConverted() Forms can contain signing information, i.e. can be signed or unsigned.
setSignDependentElementsRenderingModeWhenConverted(int signDependentElementsRenderingModeWhenConverted) Forms can contain signing information, i.e. can be signed or unsigned.
getDocument() For internal usage only
get_xfa() For internal usage only
isSynchronized() Returns true if object is thread-safe.
getSyncRoot() Returns synchronization object.
getAutoRecalculate() If set, all form fields will be recalculated when any field is changed.
setAutoRecalculate(boolean value) If set, all form fields will be recalculated when any field is changed.
getAutoRestoreForm() If set, absent form fields will be automatically created if they present in annotations.
setAutoRestoreForm(boolean value) If set, absent form fields will be automatically created if they present in annotations.
size() Gets number of the fields on this form.
getDefaultResources() Gets default resources placed on this form.
getDefaultAppearance() Gets default appearance of the form (object which describes default font, text size and color for fields on the form).
setDefaultAppearance(DefaultAppearance value) Sets default appearance of the form (object which describes default font, text size and color for fields on the form).
getXFA() Gets XFA data of the form (if presents).
getIgnoreNeedsRendering() If this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form.
setIgnoreNeedsRendering(boolean value) If this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form.
getRemovePermission() If this property is true the “Perms” dictionary will be removed from the pdf document after conversion dynamic documents to standard.
setRemovePermission(boolean value) If this property is true the “Perms” dictionary will be removed from the pdf document after conversion dynamic documents to standard.
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.
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.
getType() Gets type of the form.
setType(FormType value) Gets type of the form.
copyTo(Field[] array, int index) Copies fields placed on the form into array.
iterator() Gets enumeration of form fields.
get(String name) Searches field by field name.
get(int index)
delete(Field field) Delete field from the form.
delete(String fieldName) Deletes field from the form by its name.
flatten() Removes all static form fields and place their values directly on the page.
add(WidgetAnnotation field) Adds field on the form.
clear() Deletes all fields from form.
contains(WidgetAnnotation field) Determines if field is presented on form..
copyTo(WidgetAnnotation[] array, int arrayIndex) Copies form’s fields to array.
isReadOnly() Determines if collection is readonly.
remove(WidgetAnnotation field) Deletes field from the form.
get_Item(String name) Gets field of the form by field name.
get_Item(int index) Gets field of the form by field index.
add(Field field, int pageNumber) Adds field on the form.
add(Field field) Adds field on the form.
add(Field field, String partialName, int pageNumber) Adds new field to the form; If this field is already placed on other or this form, the copy of field is created.
addFieldAppearance(Field field, int pageNumber, Rectangle rect) Adds additional appearance of the field to specified page of the document in the specified location.
addFieldToAcroForm(Field field) Adds additional appearance of the field to specified page of the document.
hasXfa() Returns true if hasXfa
assignXfa(System.Xml.XmlDocument xml) Sets XFA of the form to specified value.
getFields() Gets list of all fields in lowest level of hierarhical form.
hasField(Field field) Check if the form already has specified field.
hasField(String fieldName) Determines if the field with specified name already added to the Form.
getFieldsInRect(Rectangle rect) Returns fields inside of specified rectangle.
setCalculatedFields(List value) Allows to set order of field calculation.
getSignaturesExist() If set, the document contains at least one signature field.
setSignaturesExist(boolean value) If set, the document contains at least one signature field.
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.
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.

Form(IDocument document)

public Form(IDocument document)

Constructor

Parameters:

Parameter Type Description
document IDocument IDocument object

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: int - SignDependentElementsRenderingModes element

setSignDependentElementsRenderingModeWhenConverted(int signDependentElementsRenderingModeWhenConverted)

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 int SignDependentElementsRenderingModes element

getDocument()

public IDocument getDocument()

For internal usage only

Returns: IDocument - IDocument object

get_xfa()

public XFA get_xfa()

For internal usage only

Returns: XFA - XFA object

isSynchronized()

public boolean isSynchronized()

Returns true if object is thread-safe.

Returns: boolean - boolean value

getSyncRoot()

public Object getSyncRoot()

Returns synchronization object.

Returns: java.lang.Object - Object for synchronization

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 - boolean value

setAutoRecalculate(boolean value)

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 boolean value

getAutoRestoreForm()

public final boolean getAutoRestoreForm()

If set, absent form fields will be automatically created if they present in annotations.

Returns: boolean - boolean value

setAutoRestoreForm(boolean value)

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 boolean value

size()

public final int size()

Gets number of the fields on this form.

Returns: int - int value

getDefaultResources()

public Resources getDefaultResources()

Gets default resources placed on this form.

Returns: Resources - Resources 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 - DefaultAppearance object

setDefaultAppearance(DefaultAppearance value)

public void setDefaultAppearance(DefaultAppearance value)

Sets default appearance of the form (object which describes default font, text size and color for fields on the form).

Parameters:

Parameter Type Description
value DefaultAppearance DefaultAppearance object

getXFA()

public XFA getXFA()

Gets XFA data of the form (if presents).

Returns: XFA - XFA value

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 - boolean value

setIgnoreNeedsRendering(boolean value)

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 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 - boolean value

setRemovePermission(boolean value)

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 boolean value

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 - boolean value

setEmulateRequierdGroups(boolean value)

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 boolean value

getType()

public FormType getType()

Gets type of the form. Possible values are: Standard, Static, Dynamic.

Returns: FormType - FormType value

setType(FormType value)

public void setType(FormType value)

Gets type of the form. Possible values are: Standard, Static, Dynamic.

Parameters:

Parameter Type Description
value FormType FormType value

copyTo(Field[] array, int index)

public void copyTo(Field[] array, int index)

Copies fields placed on the form into array.

Parameters:

Parameter Type Description
array Field[] Array where fields must be placed.
index int Starting index.

iterator()

public Iterator<WidgetAnnotation> iterator()

Gets enumeration of form fields.

Returns: java.util.Iterator<com.aspose.pdf.WidgetAnnotation> - Field enumerator.

get(String name)

public WidgetAnnotation get(String name)

Searches field by field name. Returns null if field was not found.

Parameters:

Parameter Type Description
name java.lang.String Field name.

Returns: WidgetAnnotation - Field object.

get(int index)

public WidgetAnnotation get(int index)

Parameters:

Parameter Type Description
index int

Returns: WidgetAnnotation

delete(Field field)

public void delete(Field field)

Delete field from the form.

Parameters:

Parameter Type Description
field Field Field which must be deleted.

delete(String fieldName)

public void delete(String fieldName)

Deletes field from the form by its name.

Parameters:

Parameter Type Description
fieldName java.lang.String Name of the filed which must be deleted.

flatten()

public void flatten()

Removes all static form fields and place their values directly on the page.

add(WidgetAnnotation field)

public boolean add(WidgetAnnotation field)

Adds field on the form.

Parameters:

Parameter Type Description
field WidgetAnnotation Field which must be added.

Returns: boolean - boolean value

clear()

public void clear()

Deletes all fields from form. Not supported.

contains(WidgetAnnotation field)

public boolean contains(WidgetAnnotation field)

Determines if field is presented on form..

Parameters:

Parameter Type Description
field WidgetAnnotation Field to search.

Returns: boolean - boolean value

copyTo(WidgetAnnotation[] array, int arrayIndex)

public void copyTo(WidgetAnnotation[] array, int arrayIndex)

Copies form’s fields to array.

Parameters:

Parameter Type Description
array WidgetAnnotation[] Array to copy.
arrayIndex int Index of array’s item where copying begins.

isReadOnly()

public boolean isReadOnly()

Determines if collection is readonly. Always returns false.

Returns: boolean - boolean value

remove(WidgetAnnotation field)

public boolean remove(WidgetAnnotation field)

Deletes field from the form.

Parameters:

Parameter Type Description
field WidgetAnnotation Field to delete.

Returns: boolean - True if field was deleted. False if field was not found on form.

get_Item(String name)

public WidgetAnnotation get_Item(String name)

Gets field of the form by field name. Throws excpetion if the field was not found.

Parameters:

Parameter Type Description
name java.lang.String Name of the field.

Returns: WidgetAnnotation - Retreived field.

get_Item(int index)

public WidgetAnnotation get_Item(int index)

Gets field of the form by field index.

Parameters:

Parameter Type Description
index int Index of the field.

Returns: WidgetAnnotation - Retreived field.

add(Field field, int pageNumber)

public void add(Field field, int pageNumber)

Adds field on the form.

Parameters:

Parameter Type Description
field Field Field which must be added.
pageNumber int Page index where added field will be placed.

add(Field field)

public void add(Field field)

Adds field on the form.

Parameters:

Parameter Type Description
field Field Field which must be added.

add(Field field, String partialName, int pageNumber)

public Field add(Field field, String partialName, int pageNumber)

Adds new field to the form; If this field is already placed on other or this form, the copy of field is created.

Parameters:

Parameter Type Description
field Field Field name.
partialName java.lang.String Name of field on the form.
pageNumber int Page number where field will be added.

Returns: Field - Added field returned. If copy of the field was created it will be returned.

addFieldAppearance(Field field, int pageNumber, Rectangle rect)

public void addFieldAppearance(Field field, int pageNumber, Rectangle rect)

Adds additional appearance of the field to specified page of the document in the specified location.

Parameters:

Parameter Type Description
field Field Field which appearance should be added on form.
pageNumber int Number of the page where field must be placed.
rect Rectangle Rectangle where field will be placed.

addFieldToAcroForm(Field field)

public void addFieldToAcroForm(Field field)

Adds additional appearance of the field to specified page of the document.

Parameters:

Parameter Type Description
field Field Field object

hasXfa()

public boolean hasXfa()

Returns true if hasXfa

Returns: boolean - boolean value

assignXfa(System.Xml.XmlDocument xml)

public void assignXfa(System.Xml.XmlDocument xml)

Sets XFA of the form to specified value.

Parameters:

Parameter Type Description
xml com.aspose.ms.System.Xml.XmlDocument Xml document which concains new XFA data.

getFields()

public Field[] getFields()

Gets list of all fields in lowest level of hierarhical form.

Returns: com.aspose.pdf.Field[] - Array with found fields.

hasField(Field field)

public final boolean hasField(Field field)

Check if the form already has specified field.

Parameters:

Parameter Type Description
field Field Field to check.

Returns: boolean - true if the specified field name added to Form; otherwise, false .

hasField(String fieldName)

public final boolean hasField(String fieldName)

Determines if the field with specified name already added to the Form.

Parameters:

Parameter Type Description
fieldName java.lang.String PartialName of the field.

Returns: boolean - true if the specified field name added to Form; otherwise, false .

getFieldsInRect(Rectangle rect)

public Field[] getFieldsInRect(Rectangle rect)

Returns fields inside of specified rectangle.

Parameters:

Parameter Type Description
rect Rectangle Rectangle where fields should be found.

Returns: com.aspose.pdf.Field[] - Array with found fields.

setCalculatedFields(List value)

public void setCalculatedFields(List<Field> value)

Allows to set order of field calculation.

Parameters:

Parameter Type Description
value java.util.List<com.aspose.pdf.Field> java.util.List object.

getSignaturesExist()

public final boolean getSignaturesExist()

If set, the document contains at least one signature field.

Returns: boolean - boolean value

setSignaturesExist(boolean value)

public final void setSignaturesExist(boolean value)

If set, the document contains at least one signature field.

Parameters:

Parameter Type Description
value boolean 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 - boolean value

setSignaturesAppendOnly(boolean value)

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 boolean value