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, boolean exportEmptyFields)
          Exports AcroForm field data to an output stream in FDF format.
 void exportAsFDF(String fileName, boolean exportEmptyFields)
          Exports AcroForm field data to a file in FDF format.
 void exportAsXDP(OutputStream outStream, String pdfReference, boolean exportEmptyFields)
          Exports XFA field data to an OutputStream.
 void exportAsXDP(String fileName, boolean exportEmptyFields)
          Exports XFA field data to a file in XDP format.
 void exportAsXFDF(OutputStream outStream, String pathToPDFFile, boolean exportEmptyFields)
          Exports AcroForm field data to an output stream in XML format.
 void exportAsXFDF(String fileName, boolean exportEmptyFields)
          Exports AcroForm field data to a file in XFDF format.
 void exportAsXML(OutputStream outStream, boolean useHierarchy, boolean exportEmptyFields)
          Export field values in a simple XML format.
 void exportAsXML(String fileName, boolean useHierarchy, boolean exportEmptyFields)
          Export field values in a simple XML format.
 Vector getCalculationOrder()
          Gets the list of fields with calculate actions in the correct order.
 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.
 boolean hasXFA()
          Returns true if this AcroForm has Adobe XML Forms Architecture (XFA) data.
 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(com.qoppa.nanoxml.XMLElement topElement)
          Import AcroForm field data from an xml element representing the top element of an fdf file.
 boolean isXFADynamic()
          Returns true if this AcroForm has Adobe XML Forms Architecture (XFA) data, and it is a Dynamic Form.
 boolean isXFAStatic()
          Returns true if this AcroForm has Adobe XML Forms Architecture (XFA) data, and it is a Static Form.
 void removeXFA()
          Removes the Adobe XML Forms Architecture (XFA) data from this AcroForm if present.
 void resetFields()
          Reset the form fields to their default value.
 

Method Detail

exportAsXFDF

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

Parameters:
fileName - The name of the file to export the data to.
exportEmptyFields - flag to indicate whether empty or null fields should be exported.
Throws:
PDFException

exportAsFDF

void exportAsFDF(String fileName,
                 boolean exportEmptyFields)
                 throws PDFException,
                        IOException
Exports AcroForm field data to a file in FDF format.

Parameters:
exportEmptyFields - flag to indicate whether empty or null fields should be exported.
fileName - The name of the file to export the data to.
Throws:
PDFException
IOException

exportAsXDP

void exportAsXDP(String fileName,
                 boolean exportEmptyFields)
                 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.
exportEmptyFields - flag to indicate whether empty or null fields should be exported.
Throws:
PDFException
IOException

exportAsXDP

void exportAsXDP(OutputStream outStream,
                 String pdfReference,
                 boolean exportEmptyFields)
                 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.
exportEmptyFields - flag to indicate whether empty or null fields should be exported.
Throws:
PDFException
IOException

exportAsXFDF

void exportAsXFDF(OutputStream outStream,
                  String pathToPDFFile,
                  boolean exportEmptyFields)
                  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 + fileName 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
exportEmptyFields - flag to indicate whether empty or null fields should be exported.
Throws:
IOException
PDFException

exportAsFDF

void exportAsFDF(OutputStream outStream,
                 String pathToPDFFile,
                 boolean exportEmptyFields)
                 throws PDFException,
                        IOException
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 + fileName The file entry is used when you open an fdf file to be able to locate the corresponding pdf file.
exportEmptyFields - flag to indicate whether empty or null fields should be exported. Example of pathToPDFFile ../qoppa/mydir
Throws:
PDFException
IOException

getFieldList

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

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

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

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

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

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

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

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

void importXFDF(com.qoppa.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

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

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

void exportAsXML(OutputStream outStream,
                 boolean useHierarchy,
                 boolean exportEmptyFields)
                 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

void exportAsXML(String fileName,
                 boolean useHierarchy,
                 boolean exportEmptyFields)
                 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.
exportEmptyFields - flag to indicate whether empty or null fields should be exported.
Throws:
PDFException
IOException

hasXFA

boolean hasXFA()
Returns true if this AcroForm has Adobe XML Forms Architecture (XFA) data.

Returns:
true if this form has XFA data, otherwise false

removeXFA

void removeXFA()
Removes the Adobe XML Forms Architecture (XFA) data from this AcroForm if present.


getCalculationOrder

Vector getCalculationOrder()
Gets the list of fields with calculate actions in the correct order. May return null.


isXFAStatic

boolean isXFAStatic()
Returns true if this AcroForm has Adobe XML Forms Architecture (XFA) data, and it is a Static Form.

Returns:
true if this form has Static XFA data, otherwise false

isXFADynamic

boolean isXFADynamic()
Returns true if this AcroForm has Adobe XML Forms Architecture (XFA) data, and it is a Dynamic Form.

Returns:
true if this form has Dynamic XFA data, otherwise false