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.
| Modifier and Type | Method and Description |
|---|---|
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. |
byte[] |
getXFAContents()
Returns the entire XFA contents of this form.
|
byte[] |
getXFAPacketContents(java.lang.String packetName)
Returns the contents of the XML element referenced by
packetName
in this form. |
java.util.Set |
getXFAPacketNames()
Returns a
Set of the packet names of the XFA data. |
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.
|
FormField getField(java.lang.String fullName)
AcroFormField that has the given field name, as provided by the
AcroFormField.getFullName() function.java.util.Enumeration getFieldNames()
AcroFormField.getFullName())
of all of the form fields held by this form. These names may be used as parameters into the
getField(String) function.getFieldNames in interface Formboolean writeUpdatedDocument(java.io.File dest)
throws java.io.IOException
writeUpdatedDocument(OutputStream), except
the PDF document data is written to the path specified by the given File object.java.io.IOExceptionwriteUpdatedDocument(OutputStream)boolean writeUpdatedDocument(java.io.OutputStream dest)
throws java.io.IOException
dest - - the OutputStream to which the updated PDF document data will be writtenjava.io.IOException - - if an error occurs while writing the PDF document datajava.util.Set getXFAPacketNames()
throws java.io.IOException
Set of the packet names of the XFA data. Each of
the Strings in that set may be passed to
getXFAPacketContents(String) to get the contents of that XML
element.Set of String objects, corresponding to the packet names of
XFA datajava.io.IOException - - if an error occurs while reading the PDF document databyte[] getXFAPacketContents(java.lang.String packetName)
throws java.io.IOException
packetName
in this form. To get a list of individual packets available in this form, you
may call getXFAPacketNames(). If packetName does not exist
in this form, null is returned.packetName - - the name of the XML packet to be extracted from this formjava.io.IOException - - if an error occurs while reading the PDF document databyte[] getXFAContents()
throws java.io.IOException
java.io.IOException - - if an error occurs while reading the PDF document data