public interface AcroForm extends Form<AcroFormField>
A Form
implementation that represents the
contents of an interactive PDF form,
available via Document.getFormData()
. All fields provided by a AcroForm
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 AcroForm.writeUpdatedDocument(File)
or AcroForm.writeUpdatedDocument(OutputStream)
to write out an updated copy of the source PDF document.
Modifier and Type | Method and Description |
---|---|
AcroFormField |
getField(java.lang.String fullName)
Returns the
AcroFormField that has the given field name, as provided by the
AcroFormField.getFullName() function. |
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. |
java.util.Iterator<AcroFormField> |
iterator()
Returns an
Iterator over the AcroFormField s held by this form. |
boolean |
writeUpdatedDocument(java.io.File dest)
Identical functionality to
AcroForm.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.
|
boolean |
writeUpdatedDocument(java.lang.String destinationPath)
Identical functionality to
AcroForm.writeUpdatedDocument(OutputStream) , except
the PDF document data is written to the path specified by the given String. |
getDocument, getFieldNames
AcroFormField getField(java.lang.String fullName)
AcroFormField
that has the given field name, as provided by the
AcroFormField.getFullName()
function.getField
in interface Form<AcroFormField>
java.util.Iterator<AcroFormField> iterator()
Iterator
over the AcroFormField
s held by this form.iterator
in interface Form<AcroFormField>
boolean writeUpdatedDocument(java.io.File dest)
AcroForm.writeUpdatedDocument(OutputStream)
, except
the PDF document data is written to the path specified by the given File object.AcroForm.writeUpdatedDocument(OutputStream)
boolean writeUpdatedDocument(java.lang.String destinationPath)
AcroForm.writeUpdatedDocument(OutputStream)
, except
the PDF document data is written to the path specified by the given String.AcroForm.writeUpdatedDocument(OutputStream)
boolean writeUpdatedDocument(java.io.OutputStream dest)
Document
from which this form instance
was retrieved has been closed.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()
Set
of the packet names of the XFA data. Each of
the Strings in that set may be passed to
AcroForm.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)
packetName
in this form. To get a list of individual packets available in this form, you
may call AcroForm.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()
java.io.IOException
- if an error occurs while reading the PDF document data