Class XfaForm
Processes XFA forms.
public class XfaForm
- Inheritance
-
XfaForm
- Inherited Members
Constructors
XfaForm()
An empty constructor to build on.
public XfaForm()
XfaForm(Stream)
Creates an XFA form by the stream containing all xml information
public XfaForm(Stream inputStream)
Parameters
inputStream
StreamThe InputStream
XfaForm(XDocument)
Creates an XFA form by the Document containing all xml information
public XfaForm(XDocument domDocument)
Parameters
domDocument
XDocumentThe document
XfaForm(PdfDictionary)
A constructor from a 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.
public XfaForm(PdfDictionary acroFormDictionary)
Parameters
acroFormDictionary
PdfDictionarythe dictionary object to initialize from
XfaForm(PdfDocument)
A constructor from a PdfDocument
.
public XfaForm(PdfDocument pdfDocument)
Parameters
pdfDocument
PdfDocumentthe PdfDocument instance
Remarks
A constructor from a PdfDocument
. It basically does everything
from finding the XFA stream to the XML parsing.
Fields
XFA_DATA_SCHEMA
The URI for the XFA Data schema.
public const string XFA_DATA_SCHEMA = "http://www.xfa.org/schema/xfa-data/1.0/"
Field Value
Methods
ExtractXFANodes(XDocument)
Extracts DOM nodes from an XFA document.
public static IDictionary<string, XNode> ExtractXFANodes(XDocument domDocument)
Parameters
domDocument
XDocumentan XFA file as a DOM document
Returns
- IDictionary<string, XNode>
a
of XFA packet names and their associated DOM nodes
FillXfaForm(FileInfo)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(FileInfo file)
Parameters
Remarks
Replaces the XFA data under datasets/data. Accepts a file object to fill this object with XFA data. The resulting DOM document may be modified.
FillXfaForm(FileInfo, bool)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(FileInfo file, bool readOnly)
Parameters
Remarks
Replaces the XFA data under datasets/data. Accepts a file object to fill this object with XFA data.
FillXfaForm(Stream)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(Stream @is)
Parameters
Remarks
Replaces the XFA data under datasets/data. Accepts an Stream to fill this object with XFA data. The resulting DOM document may be modified.
FillXfaForm(Stream, bool)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(Stream @is, bool readOnly)
Parameters
Remarks
Replaces the XFA data under datasets/data. Accepts an Stream to fill this object with XFA data.
FillXfaForm(XNode)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(XNode node)
Parameters
node
XNodethe input System.Xml.Linq.XNode
FillXfaForm(XNode, bool)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(XNode node, bool readOnly)
Parameters
node
XNodethe input System.Xml.Linq.XNode
readOnly
boolwhether or not the resulting DOM document may be modified
FillXfaForm(XmlReader)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(XmlReader @is)
Parameters
is
XmlReaderthe XML reader
Remarks
Replaces the XFA data under datasets/data. Accepts an XML reader to fill this object with XFA data. The resulting DOM document may be modified.
FillXfaForm(XmlReader, bool)
Replaces the XFA data under datasets/data.
public virtual void FillXfaForm(XmlReader @is, bool readOnly)
Parameters
is
XmlReaderthe XML reader
readOnly
boolwhether or not the resulting DOM document may be modified
Remarks
Replaces the XFA data under datasets/data. Accepts an XML reader to fill this object with XFA data.
FindDatasetsName(string)
Finds the complete SOM name contained in the datasets section from a possibly partial name.
public virtual string FindDatasetsName(string name)
Parameters
name
stringthe complete or partial name
Returns
- string
the complete name or
null
if not found
FindDatasetsNode(string)
Finds the Node
contained in the datasets section from a
possibly partial name.
public virtual XNode FindDatasetsNode(string name)
Parameters
name
stringthe complete or partial name
Returns
- XNode
the
Node
ornull
if not found
FindFieldName(string)
Finds the complete field name from a partial name.
public virtual string FindFieldName(string name)
Parameters
name
stringthe complete or partial name
Returns
- string
the complete name or
null
if not found
GetDatasetsNode()
Gets the Node
that corresponds to the datasets part.
public virtual XElement GetDatasetsNode()
Returns
- XElement
the
Node
that corresponds to the datasets part
GetDomDocument()
Gets the top level DOM document.
public virtual XDocument GetDomDocument()
Returns
- XDocument
the top level DOM document
GetNodeText(XNode)
Gets all the text contained in the child nodes of this node.
public static string GetNodeText(XNode n)
Parameters
n
XNodethe
Node
Returns
- string
the text found or "" if no text was found
GetNodeTextByPath(string)
Gets all the text contained in the child nodes of the node under the provided path.
public virtual string GetNodeTextByPath(string path)
Parameters
path
stringpath to the node to extract text in the format "some.path.to.node"
Returns
- string
text found under the provided path or
null
if node or text wasn't found
GetXfaFieldValue(string)
Gets the xfa field value.
public virtual string GetXfaFieldValue(string name)
Parameters
name
stringthe fully qualified field name
Returns
- string
the field value
IsXfaPresent()
Returns true
if it is a XFA form.
public virtual bool IsXfaPresent()
Returns
- bool
true
if it is a XFA form
SetDomDocument(XDocument)
Sets the top DOM document.
public virtual void SetDomDocument(XDocument domDocument)
Parameters
domDocument
XDocumentthe top DOM document
SetNodeText(XNode, string)
Sets the text of this node.
public virtual void SetNodeText(XNode n, string text)
Parameters
n
XNodethe
Node
to add the text totext
stringthe text to add
Remarks
Sets the text of this node. All the child's node are deleted and a new child text node is created.
SetXfaFieldValue(string, string)
Changes a field value in the XFA form.
public virtual void SetXfaFieldValue(string name, string value)
Parameters
SetXfaForm(XfaForm, PdfAcroForm)
Sets the XFA key from a byte array.
public static void SetXfaForm(XfaForm form, PdfAcroForm acroForm)
Parameters
form
XfaFormthe data
acroForm
PdfAcroForman AcroForm instance
Remarks
Sets the XFA key from a byte array. The old XFA is erased.
SetXfaForm(XfaForm, PdfDocument)
Sets the XFA key from a byte array.
public static void SetXfaForm(XfaForm form, PdfDocument pdfDocument)
Parameters
form
XfaFormthe data
pdfDocument
PdfDocumentpdfDocument
Remarks
Sets the XFA key from a byte array. The old XFA is erased.
Write(PdfAcroForm)
Write the XfaForm to the provided PdfDocument.
public virtual void Write(PdfAcroForm acroForm)
Parameters
acroForm
PdfAcroFormthe PdfAcroForm to write the XFA Form to
Write(PdfDocument)
Write the XfaForm to the provided PdfDocument.
public virtual void Write(PdfDocument document)
Parameters
document
PdfDocumentthe PdfDocument to write the XFA Form to