public class XfaForm extends Object
Modifier and Type | Class and Description |
---|---|
static class |
XfaForm.AcroFieldsSearch
A class to process "classic" fields.
|
static class |
XfaForm.InverseStore
A structure to store each part of a SOM name and link it to the next part
beginning from the lower hierarchy.
|
static class |
XfaForm.Stack2
Another stack implementation.
|
static class |
XfaForm.Xml2Som
A class for some basic SOM processing.
|
static class |
XfaForm.Xml2SomDatasets
Processes the datasets section in the XFA form.
|
static class |
XfaForm.Xml2SomTemplate
Processes the template section in the XFA form.
|
Modifier and Type | Field and Description |
---|---|
static String |
XFA_DATA_SCHEMA |
Constructor and Description |
---|
XfaForm()
An empty constructor to build on.
|
XfaForm(PdfReader reader)
A constructor from a
PdfReader . |
Modifier and Type | Method and Description |
---|---|
void |
fillXfaForm(File file) |
void |
fillXfaForm(InputSource is) |
void |
fillXfaForm(InputStream is) |
void |
fillXfaForm(Node node)
Replaces the 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,
AcroFields af)
Finds the complete field name contained in the "classic" forms from a partial
name.
|
XfaForm.AcroFieldsSearch |
getAcroFieldsSom()
Gets the class that contains the "classic" fields processing.
|
Node |
getDatasetsNode()
Gets the
Node that corresponds to the datasets part. |
XfaForm.Xml2SomDatasets |
getDatasetsSom()
Gets the class that contains the datasets processing section of the XFA.
|
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.
|
PdfReader |
getReader()
Gets the
PdfReader used by this instance. |
XfaForm.Xml2SomTemplate |
getTemplateSom()
Gets the class that contains the template processing section of the XFA.
|
static PdfObject |
getXfaObject(PdfReader reader)
Return the XFA Object, could be an array, could be a Stream.
|
boolean |
isChanged()
Checks if this XFA form was changed.
|
boolean |
isXfaPresent()
Returns
true if it is a XFA form. |
static byte[] |
serializeDoc(Node n)
Serializes a XML document to a byte array.
|
void |
setAcroFieldsSom(XfaForm.AcroFieldsSearch acroFieldsSom)
Sets the class that contains the "classic" fields processing.
|
void |
setChanged(boolean changed)
Sets the changed status of this XFA instance.
|
void |
setDatasetsSom(XfaForm.Xml2SomDatasets datasetsSom)
Sets the class that contains the datasets processing section of the XFA.
|
void |
setDomDocument(Document domDocument)
Sets the top DOM document.
|
void |
setNodeText(Node n,
String text)
Sets the text of this node.
|
void |
setReader(PdfReader reader)
Sets the
PdfReader to be used by this instance. |
void |
setTemplateSom(XfaForm.Xml2SomTemplate templateSom)
Sets the class that contains the template processing section of the XFA
|
void |
setXfa(PdfWriter writer)
Sets the XFA key from the instance data.
|
static void |
setXfa(XfaForm form,
PdfReader reader,
PdfWriter writer)
Sets the XFA key from a byte array.
|
void |
setXfaPresent(boolean xfaPresent)
Sets the XFA form flag signaling that this is a valid XFA form.
|
public static final String XFA_DATA_SCHEMA
public XfaForm()
public XfaForm(PdfReader reader) throws IOException, ParserConfigurationException, SAXException
PdfReader
. It basically does everything
from finding the XFA stream to the XML parsing.reader
- the readerIOException
- on errorParserConfigurationException
- on errorSAXException
- on errorpublic static PdfObject getXfaObject(PdfReader reader)
reader
- a PdfReader instancepublic static void setXfa(XfaForm form, PdfReader reader, PdfWriter writer) throws IOException
form
- the datareader
- the readerwriter
- the writerIOException
- on errorpublic void setXfa(PdfWriter writer) throws IOException
writer
- the writerIOException
- on errorpublic static byte[] serializeDoc(Node n) throws IOException
n
- the XML documentIOException
- on errorpublic boolean isXfaPresent()
true
if it is a XFA form.true
if it is a XFA formpublic Document getDomDocument()
public String findFieldName(String name, AcroFields af)
name
- the complete or partial nameaf
- the fieldsnull
if not foundpublic String findDatasetsName(String name)
name
- the complete or partial namenull
if not foundpublic Node findDatasetsNode(@Nullable 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(@Nullable Node n)
n
- the Node
public void setNodeText(@Nullable Node n, String text)
n
- the Node
to add the text totext
- the text to addpublic void setXfaPresent(boolean xfaPresent)
xfaPresent
- the XFA form flag signaling that this is a valid XFA formpublic void setDomDocument(Document domDocument)
domDocument
- the top DOM documentpublic PdfReader getReader()
PdfReader
used by this instance.PdfReader
used by this instancepublic void setReader(PdfReader reader)
PdfReader
to be used by this instance.reader
- the PdfReader
to be used by this instancepublic boolean isChanged()
true
if this XFA form was changedpublic void setChanged(boolean changed)
changed
- the changed status of this XFA instancepublic XfaForm.Xml2SomTemplate getTemplateSom()
public void setTemplateSom(XfaForm.Xml2SomTemplate templateSom)
templateSom
- the class that contains the template processing section of the XFApublic XfaForm.Xml2SomDatasets getDatasetsSom()
public void setDatasetsSom(XfaForm.Xml2SomDatasets datasetsSom)
datasetsSom
- the class that contains the datasets processing section of the XFApublic XfaForm.AcroFieldsSearch getAcroFieldsSom()
public void setAcroFieldsSom(XfaForm.AcroFieldsSearch acroFieldsSom)
acroFieldsSom
- the class that contains the "classic" fields processingpublic Node getDatasetsNode()
Node
that corresponds to the datasets part.Node
that corresponds to the datasets partpublic void fillXfaForm(File file) throws ParserConfigurationException, SAXException, IOException
public void fillXfaForm(InputStream is) throws ParserConfigurationException, SAXException, IOException
public void fillXfaForm(InputSource is) throws ParserConfigurationException, SAXException, IOException
public void fillXfaForm(Node node)
node
- node to fill data underCopyright © 2020. All rights reserved.