Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.lowagie.text.pdf
Class XfaForm

    java.lang.Object
      com.lowagie.text.pdf.XfaForm

    public class XfaForm

extends Object

Processes XFA forms.

Author:
  Paulo Soares (psoares@consiste.pt)

Nested Class Summary
`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 hierarchie.
`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.

Field Summary
`private XfaForm.AcroFieldsSearch` | `acroFieldsSom`
`private boolean` | `changed`
`private org.w3c.dom.Node` | `datasetsNode`
`private XfaForm.Xml2SomDatasets` | `datasetsSom`
`private org.w3c.dom.Document` | `domDocument`
`private PdfReader` | `reader`
`private XfaForm.Xml2SomTemplate` | `templateSom`
`static String` | `XFA_DATA_SCHEMA`
`private boolean` | `xfaPresent`

Constructor Summary
`XfaForm()` An empty constructor to build on.
`XfaForm(PdfReader reader)` A constructor from a `PdfReader`.

Method Summary
`String` | `findDatasetsName(String name)` Finds the complete SOM name contained in the datasets section from a possibly partial name.
`org.w3c.dom.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.
`org.w3c.dom.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.
`org.w3c.dom.Document` | `getDomDocument()` Gets the top level DOM document.
`static String` | `getNodeText(org.w3c.dom.Node n)` Gets all the text contained in the child nodes of this node.
`private static String` | `getNodeText(org.w3c.dom.Node n, String name)`
`PdfReader` | `getReader()` Gets the `PdfReader` used by this instance.
`XfaForm.Xml2SomTemplate` | `getTemplateSom()` Gets the class that contains the template processing section of the XFA.
`boolean` | `isChanged()` Checks if this XFA form was changed.
`boolean` | `isXfaPresent()` Returns `true` if it is a XFA form.
`static byte[]` | `serializeDoc(org.w3c.dom.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(org.w3c.dom.Document domDocument)` Sets the top DOM document.
`void` | `setNodeText(org.w3c.dom.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
`static void` | `setXfa(byte[] xfaData, PdfReader reader, PdfWriter writer)` Sets the XFA key from a byte array.
`void` | `setXfa(PdfWriter writer)` Sets the XFA key from the instance data.
`void` | `setXfaPresent(boolean xfaPresent)` Sets the XFA form flag signaling that this is a valid XFA form.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### templateSom

    private XfaForm.Xml2SomTemplate templateSom

### datasetsSom

    private XfaForm.Xml2SomDatasets datasetsSom

### acroFieldsSom

    private XfaForm.AcroFieldsSearch acroFieldsSom

### reader

    private PdfReader reader

### xfaPresent

    private boolean xfaPresent

### domDocument

    private org.w3c.dom.Document domDocument

### changed

    private boolean changed

### datasetsNode

    private org.w3c.dom.Node datasetsNode

### XFA_DATA_SCHEMA

    public static final String XFA_DATA_SCHEMA

See Also:
  Constant Field Values

Constructor Detail

### XfaForm

    public XfaForm()

  An empty constructor to build on.

### XfaForm

    public XfaForm(PdfReader reader)
            throws IOException,
                   javax.xml.parsers.ParserConfigurationException,
                   org.xml.sax.SAXException

  A constructor from a `PdfReader`. It basically does everything from finding the XFA stream to the XML parsing.

  Parameters:
    `reader` - the reader
  Throws:
    `IOException` - on error
    `javax.xml.parsers.ParserConfigurationException` - on error
    `org.xml.sax.SAXException` - on error

Method Detail

### setXfa

    public static void setXfa(byte[] xfaData,
                              PdfReader reader,
                              PdfWriter writer)
                       throws IOException

  Sets the XFA key from a byte array. The old XFA is erased.

  Parameters:
    `xfaData` - the data
    `reader` - the reader
    `writer` - the writer
  Throws:
    `IOException` - on error

### setXfa

    public void setXfa(PdfWriter writer)
                throws IOException

  Sets the XFA key from the instance data. The old XFA is erased.

  Parameters:
    `writer` - the writer
  Throws:
    `IOException` - on error

### serializeDoc

    public static byte[] serializeDoc(org.w3c.dom.Node n)
                               throws IOException

  Serializes a XML document to a byte array.

  Parameters:
    `n` - the XML document
  Returns:
    the serialized XML document
  Throws:
    `IOException` - on error

### isXfaPresent

    public boolean isXfaPresent()

  Returns `true` if it is a XFA form.

  Returns:
    `true` if it is a XFA form

### getDomDocument

    public org.w3c.dom.Document getDomDocument()

  Gets the top level DOM document.

  Returns:
    the top level DOM document

### findFieldName

    public String findFieldName(String name,
                                AcroFields af)

  Finds the complete field name contained in the "classic" forms from a partial name.

  Parameters:
    `name` - the complete or partial name
    `af` - the fields
  Returns:
    the complete name or `null` if not found

### findDatasetsName

    public String findDatasetsName(String name)

  Finds the complete SOM name contained in the datasets section from a possibly partial name.

  Parameters:
    `name` - the complete or partial name
  Returns:
    the complete name or `null` if not found

### findDatasetsNode

    public org.w3c.dom.Node findDatasetsNode(String name)

  Finds the `Node` contained in the datasets section from a possibly partial name.

  Parameters:
    `name` - the complete or partial name
  Returns:
    the `Node` or `null` if not found

### getNodeText

    public static String getNodeText(org.w3c.dom.Node n)

  Gets all the text contained in the child nodes of this node.

  Parameters:
    `n` - the `Node`
  Returns:
    the text found or "" if no text was found

### getNodeText

    private static String getNodeText(org.w3c.dom.Node n,
                                      String name)

### setNodeText

    public void setNodeText(org.w3c.dom.Node n,
                            String text)

  Sets the text of this node. All the child's node are deleted and a new child text node is created.

  Parameters:
    `n` - the `Node` to add the text to
    `text` - the text to add

### setXfaPresent

    public void setXfaPresent(boolean xfaPresent)

  Sets the XFA form flag signaling that this is a valid XFA form.

  Parameters:
    `xfaPresent` - the XFA form flag signaling that this is a valid XFA form

### setDomDocument

    public void setDomDocument(org.w3c.dom.Document domDocument)

  Sets the top DOM document.

  Parameters:
    `domDocument` - the top DOM document

### getReader

    public PdfReader getReader()

  Gets the `PdfReader` used by this instance.

  Returns:
    the `PdfReader` used by this instance

### setReader

    public void setReader(PdfReader reader)

  Sets the `PdfReader` to be used by this instance.

  Parameters:
    `reader` - the `PdfReader` to be used by this instance

### isChanged

    public boolean isChanged()

  Checks if this XFA form was changed.

  Returns:
    `true` if this XFA form was changed

### setChanged

    public void setChanged(boolean changed)

  Sets the changed status of this XFA instance.

  Parameters:
    `changed` - the changed status of this XFA instance

### getTemplateSom

    public XfaForm.Xml2SomTemplate getTemplateSom()

  Gets the class that contains the template processing section of the XFA.

  Returns:
    the class that contains the template processing section of the XFA

### setTemplateSom

    public void setTemplateSom(XfaForm.Xml2SomTemplate templateSom)

  Sets the class that contains the template processing section of the XFA

  Parameters:
    `templateSom` - the class that contains the template processing section of the XFA

### getDatasetsSom

    public XfaForm.Xml2SomDatasets getDatasetsSom()

  Gets the class that contains the datasets processing section of the XFA.

  Returns:
    the class that contains the datasets processing section of the XFA

### setDatasetsSom

    public void setDatasetsSom(XfaForm.Xml2SomDatasets datasetsSom)

  Sets the class that contains the datasets processing section of the XFA.

  Parameters:
    `datasetsSom` - the class that contains the datasets processing section of the XFA

### getAcroFieldsSom

    public XfaForm.AcroFieldsSearch getAcroFieldsSom()

  Gets the class that contains the "classic" fields processing.

  Returns:
    the class that contains the "classic" fields processing

### setAcroFieldsSom

    public void setAcroFieldsSom(XfaForm.AcroFieldsSearch acroFieldsSom)

  Sets the class that contains the "classic" fields processing.

  Parameters:
    `acroFieldsSom` - the class that contains the "classic" fields processing

### getDatasetsNode

    public org.w3c.dom.Node getDatasetsNode()

  Gets the `Node` that corresponds to the datasets part.

  Returns:
    the `Node` that corresponds to the datasets part

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD