Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.fdf

public Class FDFField

extends Object
implements COSObjectable
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.COSObjectable
Imports
java.io.IOException, .Writer, java.util.ArrayList, .List, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSInteger, .COSName, .COSNumber, .COSStream, .COSString, org.apache.pdfbox.pdmodel.common.COSArrayList, .COSObjectable, org.apache.pdfbox.pdmodel.interactive.action.PDAction, .PDActionFactory, .PDAdditionalActions, org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary, org.apache.pdfbox.util.XMLUtil, org.w3c.dom.Element, .Node, .NodeList

This represents an FDF field that is part of the FDF document.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private final COSDictionary

Constructor Summary

AccessConstructor and Description
public
FDFField()

Default constructor.

public
FDFField(COSDictionary
The FDF field.
f
)

Constructor.

public
FDFField(Element
The XML document that contains the XFDF data.
fieldXML
)

This will create an FDF field from an XFDF XML document.

Method Summary

Modifier and TypeMethod and Description
private String

Returns:

the resulting string
escapeXML
(String
the string to be escaped.
input
)

Escape special characters.

public PDAction

Returns:

The 'A' entry in the FDF field dictionary.
getAction
()

This will get the action that is associated with this field.

public PDAdditionalActions

Returns:

The 'AA' entry in this FDF field dictionary or null.
getAdditionalActions
()

This will get a list of additional actions that will get executed based on events.

public PDAppearanceDictionary

Returns:

The AP entry of this dictionary.
getAppearanceDictionary
()

This will get the appearance dictionary that specifies the appearance of a pushbutton field.

public FDFNamedPageReference

Returns:

The named page references or null.
getAppearanceStreamReference
()

This will get named page references.

public Integer

Returns:

The field flags.
getClearFieldFlags
()

This will get the 'ClrFf' entry of the FDF field dictionary.

public Integer

Returns:

The widget field flags.
getClearWidgetFieldFlags
()

This will get the 'ClrF' entry of the FDF field dictionary.

public COSDictionary

Returns:

The cos object that matches this Java object.
getCOSObject
()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

public COSBase

Returns:

The COS value of the field, maybe null.
getCOSValue
()

Returns the COS value of this field.

public Integer

Returns:

The field flags.
getFieldFlags
()

This will get the 'Ff' entry of the FDF field dictionary.

public FDFIconFit

Returns:

The 'IF' entry.
getIconFit
()

This will get the icon fit that is associated with this field.

public List<FDFField>

Returns:

The list of kids.
getKids
()

This will get the list of kids.

public List<Object>

Returns:

A list of all options.
getOptions
()

This will return a list of options for a choice field.

public String

Returns:

The partial field name.
getPartialFieldName
()

This will get the "T" entry in the field dictionary.

public String

Returns:

The rich text XHTML stream.
getRichText
()

This will set the rich text that is associated with this field.

public Integer

Returns:

The field flags.
getSetFieldFlags
()

This will get the 'SetFf' entry of the FDF field dictionary.

public Integer

Returns:

The field flags.
getSetWidgetFieldFlags
()

This will get the 'SetF' entry of the FDF field dictionary.

public Object

Returns:

The value of the field.
getValue
()

This will get the value for the field.

public Integer

Returns:

The widget field flags.
getWidgetFieldFlags
()

This will get the 'F' entry of the FDF field dictionary.

public void
setAction(PDAction
The new action.
a
)

This will set the action that is associated with this field.

public void
setAdditionalActions(PDAdditionalActions
The additional actions.
aa
)

This will set the additional actions that are associated with this field.

public void
setAppearanceDictionary(PDAppearanceDictionary
The appearance dictionary.
ap
)

This will set the appearance dictionary.

public void
setAppearanceStreamReference(FDFNamedPageReference
The named page references.
ref
)

This will set the named page references.

public void
setClearFieldFlags(Integer
The new value for the "clear field flags".
ff
)

This will set the field flags that are associated with this field.

public void
setClearFieldFlags(int
The new value for the "clear field flags".
ff
)

This will set the field flags that are associated with this field.

public void
setClearWidgetFieldFlags(Integer
The new value for the "clear widget field flags".
ff
)

This will set the field flags that are associated with this field.

public void
setClearWidgetFieldFlags(int
The new value for the "clear field flags".
ff
)

This will set the field flags that are associated with this field.

public void
setFieldFlags(Integer
The new value for the field flags.
ff
)

This will set the field flags that are associated with this field.

public void
setFieldFlags(int
The new value for the field flags.
ff
)

This will set the field flags that are associated with this field.

public void
setIconFit(FDFIconFit
The icon fit object.
fit
)

This will set the icon fit 'IF' entry.

public final void
setKids(List<FDFField>
A list of FDFField objects.
kids
)

This will set the list of kids.

public void
setOptions(List<Object>
The options to set.
options
)

This will set the options for the choice field.

public void
setPartialFieldName(String
The partial field name.
partial
)

This will set the partial field name.

public void
setRichText(COSString
The rich text value for the stream.
rv
)

This will set the rich text value.

public void
setRichText(COSStream
The rich text value for the stream.
rv
)

This will set the rich text value.

public void
setSetFieldFlags(Integer
The new value for the "set field flags".
ff
)

This will set the field flags that are associated with this field.

public void
setSetFieldFlags(int
The new value for the "set field flags".
ff
)

This will set the field flags that are associated with this field.

public void
setSetWidgetFieldFlags(Integer
The new value for the "set widget field flags".
ff
)

This will set the widget field flags that are associated with this field.

public void
setSetWidgetFieldFlags(int
The new value for the "set widget field flags".
ff
)

This will set the widget field flags that are associated with this field.

public void
setValue(Object
The value that should populate when imported.
value
)

You should pass a String, or a List<String> to set the value.

public void
setValue(COSBase
COS value.
value
)

Sets the COS value of this field.

public void
setWidgetFieldFlags(Integer
The new value for the field flags.
f
)

This will set the widget field flags that are associated with this field.

public void
setWidgetFieldFlags(int
The new value for the field flags.
f
)

This will set the field flags that are associated with this field.

public void
writeXML(Writer
The stream to write the xml to.
output
)

This will write this element as an XML document.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fieldback to summary
private final COSDictionary field

Constructor Detail

FDFFieldback to summary
public FDFField()

Default constructor.

FDFFieldback to summary
public FDFField(COSDictionary f)

Constructor.

Parameters
f:COSDictionary

The FDF field.

FDFFieldback to summary
public FDFField(Element fieldXML) throws IOException

This will create an FDF field from an XFDF XML document.

Parameters
fieldXML:Element

The XML document that contains the XFDF data.

Exceptions
IOException:
If there is an error reading from the dom.

Method Detail

escapeXMLback to summary
private String escapeXML(String input)

Escape special characters.

Parameters
input:String

the string to be escaped.

Returns:String

the resulting string

getActionback to summary
public PDAction getAction()

This will get the action that is associated with this field.

Returns:PDAction

The 'A' entry in the FDF field dictionary.

getAdditionalActionsback to summary
public PDAdditionalActions getAdditionalActions()

This will get a list of additional actions that will get executed based on events.

Returns:PDAdditionalActions

The 'AA' entry in this FDF field dictionary or null.

getAppearanceDictionaryback to summary
public PDAppearanceDictionary getAppearanceDictionary()

This will get the appearance dictionary that specifies the appearance of a pushbutton field.

Returns:PDAppearanceDictionary

The AP entry of this dictionary.

getAppearanceStreamReferenceback to summary
public FDFNamedPageReference getAppearanceStreamReference()

This will get named page references.

Returns:FDFNamedPageReference

The named page references or null.

getClearFieldFlagsback to summary
public Integer getClearFieldFlags()

This will get the 'ClrFf' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:Integer

The field flags.

getClearWidgetFieldFlagsback to summary
public Integer getClearWidgetFieldFlags()

This will get the 'ClrF' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:Integer

The widget field flags.

getCOSObjectback to summary
public COSDictionary getCOSObject()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

Returns:COSDictionary

The cos object that matches this Java object.

Annotations
@Override
getCOSValueback to summary
public COSBase getCOSValue() throws IOException

Returns the COS value of this field.

Returns:COSBase

The COS value of the field, maybe null.

Exceptions
IOException:
If there is an error getting the value.
getFieldFlagsback to summary
public Integer getFieldFlags()

This will get the 'Ff' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:Integer

The field flags.

getIconFitback to summary
public FDFIconFit getIconFit()

This will get the icon fit that is associated with this field.

Returns:FDFIconFit

The 'IF' entry.

getKidsback to summary
public List<FDFField> getKids()

This will get the list of kids. This will return a list of FDFField objects. This will return null if the underlying list is null.

Returns:List<FDFField>

The list of kids.

getOptionsback to summary
public List<Object> getOptions()

This will return a list of options for a choice field. The values in the list will be 1 of 2 types:

Returns:List<Object>

A list of all options.

getPartialFieldNameback to summary
public String getPartialFieldName()

This will get the "T" entry in the field dictionary. A partial field name. Where the fully qualified field name is a concatenation of the parent's fully qualified field name and "." as a separator. For example
Address.State
Address.City

Returns:String

The partial field name.

getRichTextback to summary
public String getRichText()

This will set the rich text that is associated with this field.

Returns:String

The rich text XHTML stream.

getSetFieldFlagsback to summary
public Integer getSetFieldFlags()

This will get the 'SetFf' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:Integer

The field flags.

getSetWidgetFieldFlagsback to summary
public Integer getSetWidgetFieldFlags()

This will get the 'SetF' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:Integer

The field flags.

getValueback to summary
public Object getValue() throws IOException

This will get the value for the field. The return type will either be:

  • String: for Checkboxes, Radio Button, Textfields
  • List<String>: for a Choice Field
Returns:Object

The value of the field.

Exceptions
IOException:
If there is an error getting the value.
getWidgetFieldFlagsback to summary
public Integer getWidgetFieldFlags()

This will get the 'F' entry of the FDF field dictionary. If it is not present then this method will return null.

Returns:Integer

The widget field flags.

setActionback to summary
public void setAction(PDAction a)

This will set the action that is associated with this field.

Parameters
a:PDAction

The new action.

setAdditionalActionsback to summary
public void setAdditionalActions(PDAdditionalActions aa)

This will set the additional actions that are associated with this field.

Parameters
aa:PDAdditionalActions

The additional actions.

setAppearanceDictionaryback to summary
public void setAppearanceDictionary(PDAppearanceDictionary ap)

This will set the appearance dictionary.

Parameters
ap:PDAppearanceDictionary

The appearance dictionary.

setAppearanceStreamReferenceback to summary
public void setAppearanceStreamReference(FDFNamedPageReference ref)

This will set the named page references.

Parameters
ref:FDFNamedPageReference

The named page references.

setClearFieldFlagsback to summary
public void setClearFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'ClrFf' entry in the FDF field dictionary.

Parameters
ff:Integer

The new value for the "clear field flags".

setClearFieldFlagsback to summary
public void setClearFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'ClrFf' entry in the FDF field dictionary.

Parameters
ff:int

The new value for the "clear field flags".

setClearWidgetFieldFlagsback to summary
public void setClearWidgetFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'ClrF' entry in the FDF field dictionary.

Parameters
ff:Integer

The new value for the "clear widget field flags".

setClearWidgetFieldFlagsback to summary
public void setClearWidgetFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'ClrF' entry in the FDF field dictionary.

Parameters
ff:int

The new value for the "clear field flags".

setFieldFlagsback to summary
public void setFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'Ff' entry in the FDF field dictionary.

Parameters
ff:Integer

The new value for the field flags.

setFieldFlagsback to summary
public void setFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'Ff' entry in the FDF field dictionary.

Parameters
ff:int

The new value for the field flags.

setIconFitback to summary
public void setIconFit(FDFIconFit fit)

This will set the icon fit 'IF' entry.

Parameters
fit:FDFIconFit

The icon fit object.

setKidsback to summary
public final void setKids(List<FDFField> kids)

This will set the list of kids.

Parameters
kids:List<FDFField>

A list of FDFField objects.

setOptionsback to summary
public void setOptions(List<Object> options)

This will set the options for the choice field. The objects in the list should either be String or FDFOptionElement.

Parameters
options:List<Object>

The options to set.

setPartialFieldNameback to summary
public void setPartialFieldName(String partial)

This will set the partial field name.

Parameters
partial:String

The partial field name.

setRichTextback to summary
public void setRichText(COSString rv)

This will set the rich text value.

Parameters
rv:COSString

The rich text value for the stream.

setRichTextback to summary
public void setRichText(COSStream rv)

This will set the rich text value.

Parameters
rv:COSStream

The rich text value for the stream.

setSetFieldFlagsback to summary
public void setSetFieldFlags(Integer ff)

This will set the field flags that are associated with this field. The 'SetFf' entry in the FDF field dictionary.

Parameters
ff:Integer

The new value for the "set field flags".

setSetFieldFlagsback to summary
public void setSetFieldFlags(int ff)

This will set the field flags that are associated with this field. The 'SetFf' entry in the FDF field dictionary.

Parameters
ff:int

The new value for the "set field flags".

setSetWidgetFieldFlagsback to summary
public void setSetWidgetFieldFlags(Integer ff)

This will set the widget field flags that are associated with this field. The 'SetF' entry in the FDF field dictionary.

Parameters
ff:Integer

The new value for the "set widget field flags".

setSetWidgetFieldFlagsback to summary
public void setSetWidgetFieldFlags(int ff)

This will set the widget field flags that are associated with this field. The 'SetF' entry in the FDF field dictionary.

Parameters
ff:int

The new value for the "set widget field flags".

setValueback to summary
public void setValue(Object value) throws IOException

You should pass a String, or a List<String> to set the value.

Parameters
value:Object

The value that should populate when imported.

Exceptions
IOException:
If there is an error setting the value.
setValueback to summary
public void setValue(COSBase value)

Sets the COS value of this field.

Parameters
value:COSBase

COS value.

setWidgetFieldFlagsback to summary
public void setWidgetFieldFlags(Integer f)

This will set the widget field flags that are associated with this field. The 'F' entry in the FDF field dictionary.

Parameters
f:Integer

The new value for the field flags.

setWidgetFieldFlagsback to summary
public void setWidgetFieldFlags(int f)

This will set the field flags that are associated with this field. The 'F' entry in the FDF field dictionary.

Parameters
f:int

The new value for the field flags.

writeXMLback to summary
public void writeXML(Writer output) throws IOException

This will write this element as an XML document.

Parameters
output:Writer

The stream to write the xml to.

Exceptions
IOException:
If there is an error writing the XML.