public class XfaForm extends Object
Modifier and Type | Field and Description |
---|---|
static String |
XFA_DATA_SCHEMA
The URI for the XFA Data schema.
|
Constructor and Description |
---|
XfaForm()
An empty constructor to build on.
|
XfaForm(Document domDocument)
Creates an XFA form by the Document containing all xml information
|
XfaForm(InputStream inputStream)
Creates an XFA form by the stream containing all xml information
|
XfaForm(PdfDictionary acroFormDictionary)
A constructor from a PdfDictionary .
|
XfaForm(PdfDocument pdfDocument)
A constructor from a PdfDocument .
|
Modifier and Type | Method and Description |
---|---|
static Map<String,Node> |
extractXFANodes(Document domDocument)
Extracts DOM nodes from an XFA document.
|
void |
fillXfaForm(File file)
Replaces the XFA data under datasets/data.
|
void |
fillXfaForm(File file, boolean readOnly)
Replaces the XFA data under datasets/data.
|
void |
fillXfaForm(InputSource is)
Replaces the XFA data under datasets/data.
|
void |
fillXfaForm(InputSource is, boolean readOnly)
Replaces the XFA data under datasets/data.
|
void |
fillXfaForm(InputStream is)
Replaces the XFA data under datasets/data.
|
void |
fillXfaForm(InputStream is, boolean readOnly)
Replaces the XFA data under datasets/data.
|
void |
fillXfaForm(Node node)
Replaces the XFA data under datasets/data.
|
void |
fillXfaForm(Node node, boolean readOnly)
Replaces the XFA data under datasets/data.
|
String |
findDatasetsName(String name)
Finds the complete SOM name contained in the datasets section from a possibly partial name.
|
Node |
findDatasetsNode(String name)
Finds the Node contained in the datasets section from a possibly partial name.
|
String |
findFieldName(String name)
Finds the complete field name from a partial name.
|
Node |
getDatasetsNode()
Gets the Node that corresponds to the datasets part.
|
Document |
getDomDocument()
Gets the top level DOM document.
|
static String |
getNodeText(Node n)
Gets all the text contained in the child nodes of this node.
|
String |
getXfaFieldValue(String name)
Gets the xfa field value.
|
boolean |
isXfaPresent()
Returns true if it is a XFA form.
|
void |
setDomDocument(Document domDocument)
Sets the top DOM document.
|
void |
setNodeText(Node n, String text)
Sets the text of this node.
|
void |
setXfaFieldValue(String name, String value)
Changes a field value in the XFA form.
|
static void |
setXfaForm(XfaForm form, PdfDocument pdfDocument)
Sets the XFA key from a byte array.
|
void |
write(PdfDocument document)
Write the XfaForm to the provided PdfDocument.
|
public static final String XFA_DATA_SCHEMA
public XfaForm()
public XfaForm(InputStream inputStream)
public XfaForm(Document domDocument)
Document
containing all xml information
public XfaForm(PdfDictionary acroFormDictionary)
PdfDictionary
. It is assumed, but not necessary for correct initialization, that the dictionary is actually a PdfAcroForm
. An entry in the dictionary with the XFA
key must contain correct XFA syntax. If the XFA
key is absent, then the constructor essentially does nothing.
acroFormDictionary
- the dictionary object to initialize from
public XfaForm(PdfDocument pdfDocument)
PdfDocument
. It basically does everything from finding the XFA stream to the XML parsing.
pdfDocument
- the PdfDocument instance
public static void setXfaForm(XfaForm form, PdfDocument pdfDocument) throws IOException
form
- the data
pdfDocument
- pdfDocument
IOException
- on IO error
public static Map<String,Node> extractXFANodes(Document domDocument)
domDocument
- an XFA file as a DOM document
Map
of XFA packet names and their associated DOM nodes
public void write(PdfDocument document) throws IOException
document
- the PdfDocument to write the XFA Form to
IOException
public void setXfaFieldValue(String name, String value)
name
- the name of the field to be changed
value
- the new value
public String getXfaFieldValue(String name)
name
- the fully qualified field name
public boolean isXfaPresent()
true
if it is a XFA form.
true
if it is a XFA form
public String findFieldName(String name)
name
- the complete or partial name
null
if not found
public String findDatasetsName(String name)
name
- the complete or partial name
null
if not found
public Node findDatasetsNode(String name)
Node
contained in the datasets section from a possibly partial name.
name
- the complete or partial name
Node
or null
if not found
public static String getNodeText(Node n)
n
- the Node
public void setNodeText(Node n, String text)
n
- the Node
to add the text to
text
- the text to add
public Document getDomDocument()
public void setDomDocument(Document domDocument)
domDocument
- the top DOM document
public Node getDatasetsNode()
Node
that corresponds to the datasets part.
Node
that corresponds to the datasets part
public void fillXfaForm(File file) throws IOException
file object
to fill this object with XFA data. The resulting DOM document may be modified.
file
- the File
IOException
- on IO error on the InputSource
public void fillXfaForm(File file, boolean readOnly) throws IOException
file object
to fill this object with XFA data.
file
- the File
readOnly
- whether or not the resulting DOM document may be modified
IOException
- on IO error on the InputSource
public void fillXfaForm(InputStream is) throws IOException
InputStream
to fill this object with XFA data. The resulting DOM document may be modified.
is
- the InputStream
IOException
- on IO error on the InputSource
public void fillXfaForm(InputStream is, boolean readOnly) throws IOException
InputStream
to fill this object with XFA data.
is
- the InputStream
readOnly
- whether or not the resulting DOM document may be modified
IOException
- on IO error on the InputSource
public void fillXfaForm(InputSource is) throws IOException
SAX input source
to fill this object with XFA data. The resulting DOM document may be modified.
is
- the SAX input source
IOException
- on IO error on the InputSource
public void fillXfaForm(InputSource is, boolean readOnly) throws IOException
SAX input source
to fill this object with XFA data.
is
- the SAX input source
readOnly
- whether or not the resulting DOM document may be modified
IOException
- on IO error on the InputSource
public void fillXfaForm(Node node)
node
- the input Node
Copyright © 1998–2016 iText Group NV. All rights reserved.