com.qoppa.pdf.form
Interface AcroForm


public interface AcroForm

This class represents the AcroForm content in a PDF document. AcroForms are the form segment in interactive PDF documents. This class can be used to get information about the fields in the PDF document and to get references to the fields to set and get their values.

Author:
Qoppa Software

Method Summary
 void exportAsFDF(OutputStream outStream, String pathToPDFFile)
          Exports AcroForm field data to an output stream in FDF format.
 void exportAsFDF(String fileName)
          Exports AcroForm field data to a file in FDF format.
 void exportAsXDP(OutputStream outStream, String pdfReference)
          Exports XFA field data to an OutputStream.
 void exportAsXDP(String fileName)
          Exports XFA field data to a file in XDP format.
 void exportAsXFDF(OutputStream outStream, String pathToPDFFile)
          Exports AcroForm field data to an output stream in XML format.
 void exportAsXFDF(String fileName)
          Exports AcroForm field data to a file in XFDF format.
 void exportAsXML(OutputStream outStream, boolean useHierarchy)
          Export field values in a simple XML format.
 void exportAsXML(String fileName, boolean useHierarchy)
          Export field values in a simple XML format.
 FormField getField(String fieldName)
          Gets a field by name.
 Vector getFieldList()
          Gets the list of fields in this AcroForm.
 Vector getSignatureFields()
          Gets a list of signature fields, if any.
 void importFDF(InputStream inStream)
          Imports AcroForm field data from an input stream in FDF format.
 void importFDF(String fileName)
          Import Acroform field data from a file in FDF Format.
 void importXDP(InputStream inStream)
          Imports XFA field data from an InputStream in XDP format.
 void importXDP(String fileName)
          Imports XFA field data from a file in XDP format.
 void importXFDF(InputStream inStream)
          Imports AcroForm field data from an input stream in XFDF format.
 void importXFDF(String fileName)
          Imports Acroform fields data from a file in XFDF Format.
 void importXFDF(nanoxml.XMLElement topElement)
          Import AcroForm field data from an xml element representing the top element of an fdf file.
 void resetFields()
          Reset the form fields to their default value.
 

Method Detail

exportAsXFDF

public void exportAsXFDF(String fileName)
                  throws PDFException
Exports AcroForm field data to a file in XFDF format.

Parameters:
fileName - The name of the file to export the data to.
Throws:
PDFException

exportAsFDF

public void exportAsFDF(String fileName)
                 throws PDFException
Exports AcroForm field data to a file in FDF format.

Parameters:
fileName - The name of the file to export the data to.
Throws:
PDFException

exportAsXDP

public void exportAsXDP(String fileName)
                 throws PDFException,
                        IOException
Exports XFA field data to a file in XDP format.

Parameters:
fileName - The name of the file to export the data to.
Throws:
PDFException
IOException

exportAsXDP

public void exportAsXDP(OutputStream outStream,
                        String pdfReference)
                 throws PDFException,
                        IOException
Exports XFA field data to an OutputStream. The output stream is left open (NOT closed) after writing the XDP data.

Parameters:
outStream - The output stream to write the data to.
pdfReference - Reference to the PDF file. This is used to the pdf/href element in the XDP file. If null, the pdf/href element is not added to the output.
Throws:
PDFException
IOException

exportAsXFDF

public void exportAsXFDF(OutputStream outStream,
                         String pathToPDFFile)
                  throws PDFException
Exports AcroForm field data to an output stream in XML format.

Parameters:
outStream - The output stream to write the data to.
pathToPDFFile - is the relative path from the fdf file to the pdf file name. This parameter can be left null. This parameter is used to fill the pdf file name entry in the FDF file, the file entry will be set to pathToPDFFile + fileNa The file entry is used when you open an fdf file to be able to locate the corresponding pdf file. Example of pathToPDFFile ../qoppa/mydir
Throws:
IOException
PDFException

exportAsFDF

public void exportAsFDF(OutputStream outStream,
                        String pathToPDFFile)
                 throws PDFException
Exports AcroForm field data to an output stream in FDF format.

Parameters:
outStream - The output stream to write the data to.
pathToPDFFile - is the relative path from the fdf file to the pdf file name. This parameter can be left null. This parameter is used to fill the pdf file name entry in the FDF file, the file entry will be set to pathToPDFFile + fileNa The file entry is used when you open an fdf file to be able to locate the corresponding pdf file. Example of pathToPDFFile ../qoppa/mydir
Throws:
PDFException

getFieldList

public Vector getFieldList()
Gets the list of fields in this AcroForm. The list returned contains objects of type FormField.

Returns:
List of fields in the AcroForm.

getSignatureFields

public Vector getSignatureFields()
Gets a list of signature fields, if any. The list returned contains objects of type SignatureField.

Returns:
List of signature fields (if any) in the AcroForm. If there are no fields, this method returns null.

getField

public FormField getField(String fieldName)
Gets a field by name. As fields can be hierarchical, names of fields can be hierarchical: choices.choice1 would refer to a field named choice1 whose parent is a field named choices.

Parameters:
fieldName - The name of a field in hierarchical form.
Returns:
AFField The field referenced by the name, null if there is no field by that name.

importFDF

public void importFDF(String fileName)
               throws PDFException
Import Acroform field data from a file in FDF Format.

Parameters:
fileName - The name of the FDF file to import the data from.
Throws:
PDFException

importFDF

public void importFDF(InputStream inStream)
               throws PDFException
Imports AcroForm field data from an input stream in FDF format.

Parameters:
inStream - The input stream in FDF format to read the data from.
Throws:
PDFException

importXFDF

public void importXFDF(String fileName)
                throws PDFException
Imports Acroform fields data from a file in XFDF Format.

Parameters:
fileName - The name of the XFDF file to import the data from.
Throws:
PDFException

importXDP

public void importXDP(String fileName)
               throws PDFException,
                      IOException
Imports XFA field data from a file in XDP format.

Parameters:
fileName - The name of the XDP file to read.
Throws:
PDFException, - IOException
PDFException
IOException

importXDP

public void importXDP(InputStream inStream)
               throws PDFException,
                      IOException
Imports XFA field data from an InputStream in XDP format. The input stream is left open (NOT closed) after reading the XDP data.

Parameters:
inStream - The input stream to read the XDP data from.
Throws:
PDFException, - IOException
PDFException
IOException

importXFDF

public void importXFDF(nanoxml.XMLElement topElement)
                throws PDFException
Import AcroForm field data from an xml element representing the top element of an fdf file.

Parameters:
topElement - The xml element representing the XFDF file.
Throws:
PDFException

importXFDF

public void importXFDF(InputStream inStream)
                throws PDFException
Imports AcroForm field data from an input stream in XFDF format.

Parameters:
inStream - The input stream in XFDF format to read the data from.
Throws:
PDFException

resetFields

public void resetFields()
                 throws PDFException
Reset the form fields to their default value. If there is no default value, then the value is set to null.

Throws:
PDFException

exportAsXML

public void exportAsXML(OutputStream outStream,
                        boolean useHierarchy)
                 throws PDFException,
                        IOException
Export field values in a simple XML format.

Parameters:
outStream - Output stream to write the XML to.
useHierarchy - Preserve the hierarchy in the form in the XML output. If this parameter is set to false, the output XML will have all the fields together in a single level below the root.
Throws:
PDFException
IOException

exportAsXML

public void exportAsXML(String fileName,
                        boolean useHierarchy)
                 throws PDFException,
                        IOException
Export field values in a simple XML format.

Parameters:
fileName - Name of the file to output the XML to.
useHierarchy - Preserve the hierarchy in the form in the XML output. If this parameter is set to false, the output XML will have all the fields together in a single level below the root.
Throws:
PDFException
IOException