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,
PdfAcroForm acroForm)
Sets the XFA key from a byte array.
|
static void |
setXfaForm(XfaForm form,
PdfDocument pdfDocument)
Sets the XFA key from a byte array.
|
void |
write(PdfAcroForm acroForm)
Write the XfaForm to the provided
PdfAcroForm. |
void |
write(PdfDocument document)
Write the XfaForm to the provided
PdfDocument. |
public static final String XFA_DATA_SCHEMA
public XfaForm()
public XfaForm(InputStream inputStream)
inputStream - the InputStreampublic XfaForm(Document domDocument)
Document containing all xml informationdomDocument - The documentpublic 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 frompublic XfaForm(PdfDocument pdfDocument)
PdfDocument. It basically does everything
from finding the XFA stream to the XML parsing.pdfDocument - the PdfDocument instancepublic static void setXfaForm(XfaForm form, PdfDocument pdfDocument) throws IOException
form - the datapdfDocument - pdfDocumentIOException - on IO errorpublic static void setXfaForm(XfaForm form, PdfAcroForm acroForm) throws IOException
form - the dataacroForm - an PdfAcroForm instanceIOException - on IO errorpublic static Map<String,Node> extractXFANodes(Document domDocument)
domDocument - an XFA file as a DOM
documentMap of XFA packet names and their associated
DOM nodespublic void write(PdfDocument document) throws IOException
PdfDocument.document - the PdfDocument to write the XFA Form toIOExceptionpublic void write(PdfAcroForm acroForm) throws IOException
PdfAcroForm.acroForm - the PdfDocument to write the XFA Form toIOExceptionpublic void setXfaFieldValue(String name, String value)
name - the name of the field to be changedvalue - the new valuepublic String getXfaFieldValue(String name)
name - the fully qualified field namepublic boolean isXfaPresent()
true if it is a XFA form.true if it is a XFA formpublic String findFieldName(String name)
name - the complete or partial namenull if not foundpublic String findDatasetsName(String name)
name - the complete or partial namenull if not foundpublic Node findDatasetsNode(String name)
Node contained in the datasets section from a
possibly partial name.name - the complete or partial nameNode or null if not foundpublic static String getNodeText(Node n)
n - the Nodepublic void setNodeText(Node n, String text)
n - the Node to add the text totext - the text to addpublic Document getDomDocument()
public void setDomDocument(Document domDocument)
domDocument - the top DOM documentpublic Node getDatasetsNode()
Node that corresponds to the datasets part.Node that corresponds to the datasets partpublic void fillXfaForm(File file) throws IOException
file
object to fill this object with XFA data. The resulting DOM document may
be modified.file - the FileIOException - on IO error on the InputSourcepublic void fillXfaForm(File file, boolean readOnly) throws IOException
file
object to fill this object with XFA data.file - the FilereadOnly - whether or not the resulting DOM document may be modifiedIOException - on IO error on the InputSourcepublic void fillXfaForm(InputStream is) throws IOException
InputStream
to fill this object with XFA data. The resulting DOM document may be
modified.is - the InputStreamIOException - on IO error on the InputSourcepublic void fillXfaForm(InputStream is, boolean readOnly) throws IOException
InputStream
to fill this object with XFA data.is - the InputStreamreadOnly - whether or not the resulting DOM document may be modifiedIOException - on IO error on the InputSourcepublic 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 sourceIOException - on IO error on the InputSourcepublic void fillXfaForm(InputSource is, boolean readOnly) throws IOException
SAX input source to fill this object with XFA data.is - the SAX input sourcereadOnly - whether or not the resulting DOM document may be modifiedIOException - on IO error on the InputSourcepublic void fillXfaForm(Node node)
node - the input NodeCopyright © 1998–2017 iText Group NV. All rights reserved.