FormField Class
Serves as the base class for PDF form fields.
Declaration
public abstract class FormField extends JavaObject implements ICloneable
Remarks
The following code snippet iterates through all form fields and prints their names and types:
// Iterate through all form fields in the document, including grouped fields.
for (FormField field : pdfDocument.getFields().toFlatIterable()) {
System.out.println(field.getName());
System.out.println(field.getClass().getSimpleName());
}
Refer to the following help topics for additional information:
Implements
Inherited Members
Inheritance
Methods
clone(DocumentCloneContext context) Method
Creates a copy of this form field in the specified clone context.
Declaration
public FormField clone(DocumentCloneContext context)
Parameters
| Name | Type | Description |
|---|---|---|
| context | DocumentCloneContext | The context used to clone document objects. |
Returns
| Type | Description |
|---|---|
FormField |
A copy of this form field. |
deepClone() Method
Creates a deep copy of this form field.
Declaration
public FormField deepClone()
Returns
| Type | Description |
|---|---|
FormField |
A deep copy of this form field. |
getActions() Method
Returns JavaScript actions associated with this form field.
Declaration
public FormFieldActions getActions()
Returns
| Type | Description |
|---|---|
| FormFieldActions | JavaScript actions associated with this form field. |
getAlternateName() Method
Returns the alternate name of this form field.
Declaration
public String getAlternateName()
Returns
| Type | Description |
|---|---|
| String | The alternate name of this form field. |
getName() Method
Returns the name of this form field.
Declaration
public String getName()
Returns
| Type | Description |
|---|---|
| String | The name of this form field. |
getReadOnly() Method
Returns whether this form field is read-only.
Declaration
public boolean getReadOnly()
Returns
| Type | Description |
|---|---|
| boolean |
|
getRequired() Method
Returns whether this form field is required.
Declaration
public boolean getRequired()
Returns
| Type | Description |
|---|---|
| boolean |
|
objectClone() Method
Creates a copy of this form field as an object.
Declaration
public Object objectClone()
Returns
| Type | Description |
|---|---|
| Object | A copy of this form field. |
setActions(FormFieldActions value) Method
Sets JavaScript actions associated with this form field.
Declaration
public void setActions(FormFieldActions value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | FormFieldActions | JavaScript actions associated with this form field. |
setAlternateName(String value) Method
Sets the alternate name of this form field.
Declaration
public void setAlternateName(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The alternate name of this form field. |
setName(String value) Method
the name of this form field.
Declaration
public void setName(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The form field name. |
Remarks
Tip
Use the PdfDocument.getFieldNameCollisions() method to identify form fields with the same name before you merge or manipulate them.
Refer to the following help topic for additional information: Resolve Merge Conflicts.
setReadOnly(boolean value) Method
Sets whether this form field is read-only.
Declaration
public void setReadOnly(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
setRequired(boolean value) Method
Sets whether this form field is required.
Declaration
public void setRequired(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|