public final class PDAcroForm extends Object implements COSObjectable
Constructor and Description |
---|
PDAcroForm(PDDocument doc)
Constructor.
|
PDAcroForm(PDDocument doc,
COSDictionary form)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
FDFDocument |
exportFDF()
This will export all FDF form data.
|
void |
flatten()
This will flatten all form fields.
|
void |
flatten(List<PDField> fields,
boolean refreshAppearances)
This will flatten the specified form fields.
|
COSDictionary |
getCOSObject()
Convert this standard java object to a COS object.
|
String |
getDefaultAppearance()
Get the default appearance.
|
PDResources |
getDefaultResources()
This will get the default resources for the acro form.
|
PDField |
getField(String fullyQualifiedName)
This will get a field by name, possibly using the cache if setCache is true.
|
Iterator<PDField> |
getFieldIterator()
Returns an iterator which walks all fields in the field tree, in order.
|
List<PDField> |
getFields()
This will return all of the documents root fields.
|
PDFieldTree |
getFieldTree()
Return the field tree representing all form fields
|
boolean |
getNeedAppearances()
True if the viewing application should construct the appearances of all field widgets.
|
int |
getQ()
This will get the 'quadding' or justification of the text to be displayed.
0 - Left(default)
1 - Centered 2 - Right Please see the QUADDING_CONSTANTS. |
PDXFAResource |
getXFA()
Get the XFA resource, the XFA resource is only used for PDF 1.5+ forms.
|
boolean |
hasXFA()
This will tell if the AcroForm has XFA content.
|
void |
importFDF(FDFDocument fdf)
This method will import an entire FDF document into the PDF document
that this acroform is part of.
|
boolean |
isAppendOnly()
Determines if AppendOnly is set.
|
boolean |
isCachingFields()
This will tell if this acro form is caching the fields.
|
boolean |
isSignaturesExist()
Determines if SignaturesExist is set.
|
void |
refreshAppearances()
Refreshes the appearance streams and appearance dictionaries for
the widget annotations of all fields.
|
void |
refreshAppearances(List<PDField> fields)
Refreshes the appearance streams and appearance dictionaries for
the widget annotations of the specified fields.
|
void |
setAppendOnly(boolean appendOnly)
Set the AppendOnly bit.
|
void |
setCacheFields(boolean cache)
This will tell this form to cache the fields into a Map structure
for fast access via the getField method.
|
void |
setDefaultAppearance(String daValue)
Set the default appearance.
|
void |
setDefaultResources(PDResources dr)
This will set the default resources for the acroform.
|
void |
setFields(List<PDField> fields)
Set the documents root fields.
|
void |
setNeedAppearances(Boolean value)
Set the NeedAppearances value.
|
void |
setQ(int q)
This will set the quadding/justification of the text.
|
void |
setSignaturesExist(boolean signaturesExist)
Set the SignaturesExist bit.
|
void |
setXFA(PDXFAResource xfa)
Set the XFA resource, this is only used for PDF 1.5+ forms.
|
boolean |
xfaIsDynamic()
This will tell if the AcroForm is a dynamic XFA form.
|
public PDAcroForm(PDDocument doc)
doc
- The document that this form is part of.public PDAcroForm(PDDocument doc, COSDictionary form)
doc
- The document that this form is part of.form
- The existing acroForm.public COSDictionary getCOSObject()
COSObjectable
getCOSObject
in interface COSObjectable
public void importFDF(FDFDocument fdf) throws IOException
fdf
- The FDF document to import.IOException
- If there is an error doing the import.public FDFDocument exportFDF() throws IOException
IOException
- If there is an error when exporting the document.public void flatten() throws IOException
Flattening a form field will take the current appearance and make that part of the pages content stream. All form fields and annotations associated are removed.
The appearances for the form fields widgets will not be generated
IOException
public void flatten(List<PDField> fields, boolean refreshAppearances) throws IOException
Flattening a form field will take the current appearance and make that part of the pages content stream. All form fields and annotations associated are removed.
fields
- refreshAppearances
- if set to true the appearances for the form field widgets will be updatedIOException
public void refreshAppearances() throws IOException
IOException
public void refreshAppearances(List<PDField> fields) throws IOException
fields
- IOException
public List<PDField> getFields()
PDNonTerminalField.getChildren()
.public void setFields(List<PDField> fields)
fields
- The fields that are part of the documents root fields.public Iterator<PDField> getFieldIterator()
public PDFieldTree getFieldTree()
public void setCacheFields(boolean cache)
cache
- A boolean telling if we should cache the fields.public boolean isCachingFields()
public PDField getField(String fullyQualifiedName)
fullyQualifiedName
- The name of the field to get.public String getDefaultAppearance()
public void setDefaultAppearance(String daValue)
daValue
- a string describing the default appearancepublic boolean getNeedAppearances()
public void setNeedAppearances(Boolean value)
value
- the value for NeedAppearancespublic PDResources getDefaultResources()
public void setDefaultResources(PDResources dr)
dr
- The new default resources.public boolean hasXFA()
public boolean xfaIsDynamic()
public PDXFAResource getXFA()
public void setXFA(PDXFAResource xfa)
xfa
- The xfa resource.public int getQ()
public void setQ(int q)
q
- The new text justification.public boolean isSignaturesExist()
public void setSignaturesExist(boolean signaturesExist)
signaturesExist
- The value for SignaturesExist.public boolean isAppendOnly()
public void setAppendOnly(boolean appendOnly)
appendOnly
- The value for AppendOnly.Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.