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
public abstract class PDTerminalField extends PDField
A field in an interactive form. Fields may be one of four types: button, text, choice, or signature.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPDTerminalField(PDAcroForm acroForm)Constructor.(package private)PDTerminalField(PDAcroForm acroForm, COSDictionary field, PDNonTerminalField parent)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidapplyChange()Applies a value change to the field.(package private) abstract voidconstructAppearances()Constructs appearance streams and appearance dictionaries for all widget annotations.(package private) FDFFieldexportFDF()Exports this field and its children as FDF.intgetFieldFlags()This will get the flags for this field.java.lang.StringgetFieldType()Get the FT entry of the field.java.util.List<PDAnnotationWidget>getWidgets()Returns the widget annotations associated with this field.voidimportFDF(FDFField fdfField)This will import a fdf field from a fdf document.voidsetActions(PDFormFieldAdditionalActions actions)Set the actions of the field.voidsetWidgets(java.util.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 Detail
-
PDTerminalField
protected PDTerminalField(PDAcroForm acroForm)
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 Detail
-
setActions
public void setActions(PDFormFieldAdditionalActions actions)
Set the actions of the field.- Parameters:
actions- The field actions.
-
getFieldFlags
public int getFieldFlags()
Description copied from class:PDFieldThis will get the flags for this field.- Specified by:
getFieldFlagsin classPDField- Returns:
- flags The set of flags.
-
getFieldType
public java.lang.String getFieldType()
Description copied from class:PDFieldGet 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:
getFieldTypein classPDField- Returns:
- The Field type.
-
importFDF
public void importFDF(FDFField fdfField) throws java.io.IOException
Description copied from class:PDFieldThis will import a fdf field from a fdf document.
-
exportFDF
FDFField exportFDF() throws java.io.IOException
Description copied from class:PDFieldExports this field and its children as FDF.
-
getWidgets
public java.util.List<PDAnnotationWidget> getWidgets()
Returns the widget annotations associated with this field.- Specified by:
getWidgetsin 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
public void setWidgets(java.util.List<PDAnnotationWidget> children)
Sets the field's widget annotations.- Parameters:
children- The list of widget annotations.
-
applyChange
protected final void applyChange() throws java.io.IOExceptionApplies a value change to the field. Generates appearances if required and raises events.- Throws:
java.io.IOException- if the appearance couldn't be generated
-
constructAppearances
abstract void constructAppearances() throws java.io.IOExceptionConstructs appearance streams and appearance dictionaries for all widget annotations. Subclasses should not call this method directly but viaapplyChange().- Throws:
java.io.IOException- if the appearance couldn't be generated
-
-