com.snowtide.pdf.forms
Interface AcroForm

All Superinterfaces:
Form

public interface AcroForm
extends Form

A Form implementation that represents the contents of an interactive PDF form, available via PDFTextStream.getFormData().

All FormField elements contained by an AcroForm shall also implement the AcroFormField interface.

Note that field names are mapped to AcroFormField instances using each AcroFormField's fully-qualified name. This is to ensure that one and only one AcroFormField is mapped to a particular field name, as provided for by the PDF specification.

Text, checkbox, radio button group, and choice fields may be updated. After updating such fields, simply call writeUpdatedDocument(File) or writeUpdatedDocument(OutputStream) as appropriate to write out an updated copy of the source PDF document.

NOTE: If PDFTextStream is not fully licensed, then the values of approximately half of all FormField objects will be slightly modified (upon both retrieval and updating).

Version:
©2004-2008 Snowtide Informatics Systems, Inc.

Method Summary
 FormField getField(java.lang.String fullName)
          Returns the AcroFormField that has the given field name, as provided by the AcroFormField.getFullName() function.
 java.util.Enumeration getFieldNames()
          Returns an Enumeration of the full field names (as provided by AcroFormField.getFullName()) of all of the form fields held by this form.
 boolean writeUpdatedDocument(java.io.File dest)
          Identical functionality to writeUpdatedDocument(OutputStream), except the PDF document data is written to the path specified by the given File object.
 boolean writeUpdatedDocument(java.io.OutputStream dest)
          If any field values contained in this form have been changed, then this function writes a copy of the PDF document from which this form was read to the given OutputStream, and appends the updated form field values.
 
Methods inherited from interface com.snowtide.pdf.forms.Form
iterator
 

Method Detail

getField

public FormField getField(java.lang.String fullName)
Returns the AcroFormField that has the given field name, as provided by the AcroFormField.getFullName() function.

Specified by:
getField in interface Form

getFieldNames

public java.util.Enumeration getFieldNames()
Returns an Enumeration of the full field names (as provided by AcroFormField.getFullName()) of all of the form fields held by this form. These names may be used as parameters into the getField(String) function.

Specified by:
getFieldNames in interface Form

writeUpdatedDocument

public boolean writeUpdatedDocument(java.io.File dest)
                             throws java.io.IOException
Identical functionality to writeUpdatedDocument(OutputStream), except the PDF document data is written to the path specified by the given File object.

Throws:
java.io.IOException
Since:
v2.1
See Also:
writeUpdatedDocument(OutputStream)

writeUpdatedDocument

public boolean writeUpdatedDocument(java.io.OutputStream dest)
                             throws java.io.IOException
If any field values contained in this form have been changed, then this function writes a copy of the PDF document from which this form was read to the given OutputStream, and appends the updated form field values. In this case, this function will always return true. If no field values have been changed, then this function will do nothing, and return false. This function will fail with an exception if the PDFTextStream instance from which this form instance was retrieved has been closed.

Parameters:
dest - - the OutputStream to which the updated PDF document data will be written
Returns:
- true if any field values in this form have been changed, and updated PDF document data has been written to the given OutputStream; if no field values have been changed, then no data will be written, and false is returned
Throws:
java.io.IOException - - if an error occurs while writing the PDF document data
Since:
v2.1