Package com.lowagie.text.pdf
Class XfdfReader
- java.lang.Object
-
- com.lowagie.text.pdf.XfdfReader
-
- All Implemented Interfaces:
FieldReader,SimpleXMLDocHandler
public class XfdfReader extends Object implements SimpleXMLDocHandler, FieldReader
Reads a XFDF.- Author:
- Leonard Rosenthol (leonardr@pdfsages.com)
-
-
Constructor Summary
Constructors Constructor Description XfdfReader(byte[] xfdfIn)Reads an XFDF form.XfdfReader(String filename)Reads an XFDF form.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidendDocument()Called after the document is parsed.voidendElement(String tag)Called when an end tag is found.Map<String,String>getAllFields()StringgetField(String name)Gets the field value.HashMap<String,String>getFields()Deprecated.usegetAllFields()StringgetFieldValue(String name)Gets the field value ornullif the field does not exist or has no value defined.StringgetFileSpec()Gets the PDF file specification contained in the FDF.List<String>getListValues(String name)Gets the field values for a list ornullif the field does not exist or has no value defined.voidstartDocument()Called when the document starts to be parsed.voidstartElement(String tag, HashMap h)Deprecated.voidstartElement(String tag, Map<String,String> h)Called when a start tag is found.voidtext(String str)Called when a text element is found.
-
-
-
Constructor Detail
-
XfdfReader
public XfdfReader(String filename) throws IOException
Reads an XFDF form.- Parameters:
filename- the file name of the form- Throws:
IOException- on error
-
XfdfReader
public XfdfReader(byte[] xfdfIn) throws IOExceptionReads an XFDF form.- Parameters:
xfdfIn- the byte array with the form- Throws:
IOException- on error
-
-
Method Detail
-
getFields
@Deprecated public HashMap<String,String> getFields()
Deprecated.usegetAllFields()Gets all the fields. The map is keyed by the fully qualified field name and the value is a mergedPdfDictionarywith the field content.- Specified by:
getFieldsin interfaceFieldReader- Returns:
- all the fields
-
getAllFields
public Map<String,String> getAllFields()
- Specified by:
getAllFieldsin interfaceFieldReader
-
getField
public String getField(String name)
Gets the field value.- Parameters:
name- the fully qualified field name- Returns:
- the field's value
-
getFieldValue
public String getFieldValue(String name)
Gets the field value ornullif the field does not exist or has no value defined.- Specified by:
getFieldValuein interfaceFieldReader- Parameters:
name- the fully qualified field name- Returns:
- the field value or
null
-
getListValues
public List<String> getListValues(String name)
Gets the field values for a list ornullif the field does not exist or has no value defined.- Specified by:
getListValuesin interfaceFieldReader- Parameters:
name- the fully qualified field name- Returns:
- the field values or
null - Since:
- 2.1.4
-
getFileSpec
public String getFileSpec()
Gets the PDF file specification contained in the FDF.- Returns:
- the PDF file specification contained in the FDF
-
startElement
@Deprecated public void startElement(String tag, HashMap h)
Deprecated.Called when a start tag is found.- Specified by:
startElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag nameh- the tag's attributes
-
startElement
public void startElement(String tag, Map<String,String> h)
Called when a start tag is found.- Specified by:
startElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag nameh- the tag's attributes
-
endElement
public void endElement(String tag)
Called when an end tag is found.- Specified by:
endElementin interfaceSimpleXMLDocHandler- Parameters:
tag- the tag name
-
startDocument
public void startDocument()
Called when the document starts to be parsed.- Specified by:
startDocumentin interfaceSimpleXMLDocHandler
-
endDocument
public void endDocument()
Called after the document is parsed.- Specified by:
endDocumentin interfaceSimpleXMLDocHandler
-
text
public void text(String str)
Called when a text element is found.- Specified by:
textin interfaceSimpleXMLDocHandler- Parameters:
str- the text element, probably a fragment.
-
-