Class PDTerminalField
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.form.PDField
org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDButton
,PDSignatureField
,PDVariableText
A field in an interactive form.
Fields may be one of four types: button, text, choice, or signature.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PDTerminalField
(PDAcroForm acroForm) Constructor.(package private)
PDTerminalField
(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Applies a value change to the field.(package private) abstract void
Constructs appearance streams and appearance dictionaries for all widget annotations.(package private) FDFField
Exports this field and its children as FDF.int
This will get the flags for this field.Get the FT entry of the field.Deprecated.Returns the widget annotations associated with this field.void
This will import a fdf field from a fdf document.void
setActions
(PDFormFieldAdditionalActions actions) Set the actions of the field.void
setWidgets
(List<PDAnnotationWidget> children) Sets the field's widget annotations.Methods inherited from class org.apache.pdfbox.pdmodel.interactive.form.PDField
findKid, fromDictionary, getAcroForm, getActions, getAlternateFieldName, getCOSObject, getFullyQualifiedName, getInheritableAttribute, getMappingName, getParent, getPartialName, getValueAsString, isNoExport, isReadOnly, isRequired, setAlternateFieldName, setFieldFlags, setMappingName, setNoExport, setPartialName, setReadOnly, setRequired, setValue, toString
-
Constructor Details
-
PDTerminalField
Constructor.- Parameters:
acroForm
- The form that this field is part of.
-
PDTerminalField
PDTerminalField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent) Constructor.- Parameters:
acroForm
- The form that this field is part of.field
- the PDF object to represent as a field.parent
- the parent node of the node
-
-
Method Details
-
setActions
Set the actions of the field.- Parameters:
actions
- The field actions.
-
getFieldFlags
public int getFieldFlags()Description copied from class:PDField
This will get the flags for this field.- Specified by:
getFieldFlags
in classPDField
- Returns:
- flags The set of flags.
-
getFieldType
Description copied from class:PDField
Get the FT entry of the field. This is a read only field and is set depending on the actual type. The field type is an inheritable attribute.- Specified by:
getFieldType
in classPDField
- Returns:
- The Field type.
-
importFDF
Description copied from class:PDField
This will import a fdf field from a fdf document.- Overrides:
importFDF
in classPDField
- Parameters:
fdfField
- The fdf field to import.- Throws:
IOException
- If there is an error importing the data for this field.
-
exportFDF
Description copied from class:PDField
Exports this field and its children as FDF.- Specified by:
exportFDF
in classPDField
- Throws:
IOException
-
getWidgets
Returns the widget annotations associated with this field.- Specified by:
getWidgets
in classPDField
- Returns:
- The list of widget annotations. Be aware that this list is not backed by the
actual widget collection of the field, so adding or deleting has no effect on the PDF
document until you call
setWidgets()
with the modified list.
-
setWidgets
Sets the field's widget annotations.- Parameters:
children
- The list of widget annotations.
-
getWidget
Deprecated.Fields may have more than one widget, callgetWidgets()
instead.This will get the single associated widget that is part of this field. This occurs when the Widget is embedded in the fields dictionary. Sometimes there are multiple sub widgets associated with this field, in which case you want to use getWidgets(). If the kids entry is specified, then the first entry in that list will be returned.- Returns:
- The widget that is associated with this field.
-
applyChange
Applies a value change to the field. Generates appearances if required and raises events.- Throws:
IOException
- if the appearance couldn't be generated
-
constructAppearances
Constructs appearance streams and appearance dictionaries for all widget annotations. Subclasses should not call this method directly but viaapplyChange()
.- Throws:
IOException
- if the appearance couldn't be generated
-
getWidgets()
instead.