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<T>
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 |
---|---|
static Map<String,Node> |
extractXFANodes(Document domDocument) |
void |
fillXfaForm(File file) |
void |
fillXfaForm(File file, boolean readOnly) |
void |
fillXfaForm(InputSource is) |
void |
fillXfaForm(InputSource is, boolean readOnly) |
void |
fillXfaForm(InputStream is) |
void |
fillXfaForm(InputStream is, boolean readOnly) |
void |
fillXfaForm(Node node) |
void |
fillXfaForm(Node node, boolean readOnly)
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 reader
IOException
- on error
ParserConfigurationException
- on error
SAXException
- on error
public static PdfObject getXfaObject(PdfReader reader)
reader
- a PdfReader instance
public static void setXfa(XfaForm form, PdfReader reader, PdfWriter writer) throws IOException
form
- the data
reader
- the reader
writer
- the writer
IOException
- on error
public void setXfa(PdfWriter writer) throws IOException
writer
- the writer
IOException
- on error
public static byte[] serializeDoc(Node n) throws IOException
n
- the XML document
IOException
- on error
public boolean isXfaPresent()
true
if it is a XFA form.
true
if it is a XFA form
public Document getDomDocument()
public String findFieldName(String name, AcroFields af)
name
- the complete or partial name
af
- the fields
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 void setXfaPresent(boolean xfaPresent)
xfaPresent
- the XFA form flag signaling that this is a valid XFA form
public void setDomDocument(Document domDocument)
domDocument
- the top DOM document
public PdfReader getReader()
PdfReader
used by this instance.
PdfReader
used by this instance
public void setReader(PdfReader reader)
PdfReader
to be used by this instance.
reader
- the PdfReader
to be used by this instance
public boolean isChanged()
true
if this XFA form was changed
public void setChanged(boolean changed)
changed
- the changed status of this XFA instance
public XfaForm.Xml2SomTemplate getTemplateSom()
public void setTemplateSom(XfaForm.Xml2SomTemplate templateSom)
templateSom
- the class that contains the template processing section of the XFA
public XfaForm.Xml2SomDatasets getDatasetsSom()
public void setDatasetsSom(XfaForm.Xml2SomDatasets datasetsSom)
datasetsSom
- the class that contains the datasets processing section of the XFA
public XfaForm.AcroFieldsSearch getAcroFieldsSom()
public void setAcroFieldsSom(XfaForm.AcroFieldsSearch acroFieldsSom)
acroFieldsSom
- the class that contains the "classic" fields processing
public Node getDatasetsNode()
Node
that corresponds to the datasets part.
Node
that corresponds to the datasets part
public void fillXfaForm(File file) throws IOException
IOException
public void fillXfaForm(File file, boolean readOnly) throws IOException
IOException
public void fillXfaForm(InputStream is) throws IOException
IOException
public void fillXfaForm(InputStream is, boolean readOnly) throws IOException
IOException
public void fillXfaForm(InputSource is) throws IOException
IOException
public void fillXfaForm(InputSource is, boolean readOnly) throws IOException
IOException
public void fillXfaForm(Node node)
public void fillXfaForm(Node node, boolean readOnly)
Copyright © 1998–2018. All rights reserved.