Table of Contents

Class XfaForm

Namespace
iText.Forms.Xfa
Assembly
itext.forms.dll

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 Stream

The InputStream

XfaForm(XDocument)

Creates an XFA form by the Document containing all xml information

public XfaForm(XDocument domDocument)

Parameters

domDocument XDocument

The 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 PdfDictionary

the dictionary object to initialize from

XfaForm(PdfDocument)

A constructor from a PdfDocument.

public XfaForm(PdfDocument pdfDocument)

Parameters

pdfDocument PdfDocument

the 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

string

Methods

ExtractXFANodes(XDocument)

Extracts DOM nodes from an XFA document.

public static IDictionary<string, XNode> ExtractXFANodes(XDocument domDocument)

Parameters

domDocument XDocument

an 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

file FileInfo

the FileInfo

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

file FileInfo

the FileInfo

readOnly bool

whether or not the resulting DOM document may be modified

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

is Stream

the Stream

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

is Stream

the Stream

readOnly bool

whether or not the resulting DOM document may be modified

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 XNode

the 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 XNode

the input System.Xml.Linq.XNode

readOnly bool

whether 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 XmlReader

the 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 XmlReader

the XML reader

readOnly bool

whether 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 string

the 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 string

the complete or partial name

Returns

XNode

the Node or null if not found

FindFieldName(string)

Finds the complete field name from a partial name.

public virtual string FindFieldName(string name)

Parameters

name string

the 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 XNode

the 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 string

path 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 string

the 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 XDocument

the top DOM document

SetNodeText(XNode, string)

Sets the text of this node.

public virtual void SetNodeText(XNode n, string text)

Parameters

n XNode

the Node to add the text to

text string

the 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

name string

the name of the field to be changed

value string

the new value

SetXfaForm(XfaForm, PdfAcroForm)

Sets the XFA key from a byte array.

public static void SetXfaForm(XfaForm form, PdfAcroForm acroForm)

Parameters

form XfaForm

the data

acroForm PdfAcroForm

an 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 XfaForm

the data

pdfDocument PdfDocument

pdfDocument

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 PdfAcroForm

the PdfAcroForm to write the XFA Form to

Write(PdfDocument)

Write the XfaForm to the provided PdfDocument.

public virtual void Write(PdfDocument document)

Parameters

document PdfDocument

the PdfDocument to write the XFA Form to