Package com.itextpdf.text.pdf
Class XfdfReader
java.lang.Object
com.itextpdf.text.pdf.XfdfReader
- All Implemented Interfaces:
SimpleXMLDocHandler
Reads a XFDF.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String
private boolean
Storage for field values if there's more than one value for a field. -
Constructor Summary
ConstructorsConstructorDescriptionXfdfReader
(byte[] xfdfIn) Reads an XFDF form.Reads an XFDF form.XfdfReader
(String filename) Reads an XFDF form. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called after the document is parsed.void
endElement
(String tag) Called when an end tag is found.Gets the field value.Gets all the fields.getFieldValue
(String name) Gets the field value ornull
if the field does not exist or has no value defined.Gets the PDF file specification contained in the FDF.getListValues
(String name) Gets the field values for a list ornull
if the field does not exist or has no value defined.void
Called when the document starts to be parsed.void
startElement
(String tag, Map<String, String> h) Called when a start tag is found.void
Called when a text element is found.
-
Field Details
-
foundRoot
private boolean foundRoot -
fieldNames
-
fieldValues
-
fields
-
listFields
Storage for field values if there's more than one value for a field.- Since:
- 2.1.4
-
fileSpec
String fileSpec
-
-
Constructor Details
-
XfdfReader
Reads an XFDF form.- Parameters:
filename
- the file name of the form- Throws:
IOException
- on error
-
XfdfReader
Reads an XFDF form.- Parameters:
xfdfIn
- the byte array with the form- Throws:
IOException
- on error
-
XfdfReader
Reads an XFDF form.- Parameters:
is
- an InputStream to read the form- Throws:
IOException
- on error- Since:
- 5.0.1
-
-
Method Details
-
getFields
Gets all the fields. The map is keyed by the fully qualified field name and the value is a mergedPdfDictionary
with the field content.- Returns:
- all the fields
-
getField
Gets the field value.- Parameters:
name
- the fully qualified field name- Returns:
- the field's value
-
getFieldValue
Gets the field value ornull
if the field does not exist or has no value defined.- Parameters:
name
- the fully qualified field name- Returns:
- the field value or
null
-
getListValues
Gets the field values for a list ornull
if the field does not exist or has no value defined.- Parameters:
name
- the fully qualified field name- Returns:
- the field values or
null
- Since:
- 2.1.4
-
getFileSpec
Gets the PDF file specification contained in the FDF.- Returns:
- the PDF file specification contained in the FDF
-
startElement
Called when a start tag is found.- Specified by:
startElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag nameh
- the tag's attributes
-
endElement
Called when an end tag is found.- Specified by:
endElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag name
-
startDocument
public void startDocument()Called when the document starts to be parsed.- Specified by:
startDocument
in interfaceSimpleXMLDocHandler
-
endDocument
public void endDocument()Called after the document is parsed.- Specified by:
endDocument
in interfaceSimpleXMLDocHandler
-
text
Called when a text element is found.- Specified by:
text
in interfaceSimpleXMLDocHandler
- Parameters:
str
- the text element, probably a fragment.
-