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

ConstructorDescription
FormConstructor

Methods

MethodDescription
addAdds field on the form.
addAdds field on the form.
addAdds new field to the form; If this field is already placed on other or this form, the copy of field is created.
addAdds field on the form.
addFieldAppearanceAdds additional appearance of the field to specified page of the document in the specified location.
addFieldToAcroFormAdds additional appearance of the field to specified page of the document.
assignXfaSets XFA of the form to specified value.
clearDeletes all fields from form. Not supported.
containsDetermines if field is presented on form..
copyToCopies fields placed on the form into array.
copyToCopies form’s fields to array.
deleteDelete field from the form.
deleteDeletes field from the form by its name.
flattenRemoves all static form fields and place their values directly on the page.
get_ItemGets field of the form by field index.
get_ItemGets field of the form by field name. Throws excpetion if the field was not found.
get_xfaFor internal usage only
get
getSearches field by field name. Returns null if field was not found.
getAutoRecalculateIf 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.
getAutoRestoreFormIf set, absent form fields will be automatically created if they present in annotations.
getDefaultAppearanceGets default appearance of the form (object which describes default font, text size and color for fields on the form).
getDefaultResourcesGets default resources placed on this form.
getDocumentFor internal usage only
getEmulateRequierdGroupsIf 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.
getFieldsGets list of all fields in lowest level of hierarhical form.
getFieldsInRectReturns fields inside of specified rectangle.
getIgnoreNeedsRenderingIf this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form. It is false by default.
getNeedsRenderingGets 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.
getRemovePermissionIf 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.
getSignaturesAppendOnlyIf 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.
getSignaturesExistIf set, the document contains at least one signature field.
getSignDependentElementsRenderingModeWhenConvertedForms 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.
getSyncRootReturns synchronization object.
getTypeGets type of the form. Possible values are: Standard, Static, Dynamic.
getXFAGets XFA data of the form (if presents).
hasFieldCheck if the form already has specified field.
hasFieldDetermines if the field with specified name already added to the Form.
hasFieldDetermines if the field with specified name already added to the Form, with ability to look into children hierarchy of fields.
hasXfaGets 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.
isReadOnlyDetermines if collection is readonly. Always returns false.
isSynchronizedReturns true if object is thread-safe.
iteratorGets 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(); / *
removeDeletes field from the form.
removeFieldAppearanceRemoves appearance of the field at specified index. If only one child appearance left, method embeds it into the field.
setAutoRecalculateIf 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.
setAutoRestoreFormIf set, absent form fields will be automatically created if they present in annotations.
setCalculatedFieldsAllows to set order of field calculation.
setDefaultAppearanceSets default appearance of the form (object which describes default font, text size and color for fields on the form).
setEmulateRequierdGroupsIf 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.
setIgnoreNeedsRenderingIf this property is true the value of NeedsRendering key will be ignored during conversion XFA form to Standard form. It is false by default.
setRemovePermissionIf 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.
setSignaturesAppendOnlyIf 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.
setSignaturesExistIf set, the document contains at least one signature field.
setSignDependentElementsRenderingModeWhenConvertedForms 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.
setTypeGets type of the form. Possible values are: Standard, Static, Dynamic.
sizeGets 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:

ParameterTypeDescription
indexIndex 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:

ParameterTypeDescription
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:

ParameterTypeDescription
valueboolean value

setAutoRestoreForm

public final void setAutoRestoreForm(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean 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:

ParameterTypeDescription
valueboolean 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:

ParameterTypeDescription
valueboolean 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:

ParameterTypeDescription
valueboolean 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:

ParameterTypeDescription
valueboolean value

setSignaturesExist

public final void setSignaturesExist(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean 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:

ParameterTypeDescription
signDependentElementsRenderingModeWhenConvertedSignDependentElementsRenderingModes 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