COSObjectable
PDChoiceButton
, PDPushButton
, PDSignature
, PDSignatureField
, PDUnknownField
, PDVariableText
public abstract class PDField extends java.lang.Object implements COSObjectable
Modifier and Type | Field | Description |
---|---|---|
static int |
FLAG_NO_EXPORT |
A Ff flag.
|
static int |
FLAG_READ_ONLY |
A Ff flag.
|
static int |
FLAG_REQUIRED |
A Ff flag.
|
Constructor | Description |
---|---|
PDField(PDAcroForm theAcroForm) |
Constructor.
|
PDField(PDAcroForm theAcroForm,
COSDictionary field) |
Creates a COSField from a COSDictionary, expected to be a correct object definition for a field in PDF.
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
findFieldType() |
Find the field type and optionally do a recursive upward search.
|
PDField |
findKid(java.lang.String[] name,
int nameIndex) |
This will find one of the child elements.
|
PDAcroForm |
getAcroForm() |
This will get the acroform that this field is part of.
|
PDFormFieldAdditionalActions |
getActions() |
Get the additional actions for this field.
|
java.lang.String |
getAlternateFieldName() |
Gets the alternate name of the field.
|
COSBase |
getCOSObject() |
Convert this standard java object to a COS object.
|
COSDictionary |
getDictionary() |
This will get the dictionary associated with this field.
|
int |
getFieldFlags() |
This will get the flags for this field.
|
java.lang.String |
getFieldType() |
Get the FT entry of the field.
|
java.lang.String |
getFullyQualifiedName() |
Returns the fully qualified name of the field, which is a concatenation of the names of all the parents fields.
|
java.util.List<COSObjectable> |
getKids() |
This will get all the kids of this field.
|
PDField |
getParent() |
Get the parent field to this field, or null if none exists.
|
java.lang.String |
getPartialName() |
Returns the partial name of the field.
|
abstract java.lang.String |
getValue() |
getValue gets the fields value to as a string.
|
PDAnnotationWidget |
getWidget() |
This will get the single associated widget that is part of this field.
|
java.util.List<PDAnnotationWidget> |
getWidgets() |
Returns the widget annotations associated with this field.
|
void |
importFDF(FDFField fdfField) |
This will import a fdf field from a fdf document.
|
boolean |
isNoExport() |
|
boolean |
isReadonly() |
|
boolean |
isRequired() |
|
void |
setAcroForm(PDAcroForm value) |
This will set the form this field is on.
|
void |
setActions(PDFormFieldAdditionalActions actions) |
Set the actions of the field.
|
void |
setAlternateFieldName(java.lang.String alternateFieldName) |
This will set the alternate name of the field.
|
void |
setFieldFlags(int flags) |
This will set the flags for this field.
|
protected void |
setFieldType(java.lang.String fieldType) |
Set the field type.
|
void |
setKids(java.util.List<COSObjectable> kids) |
This will set the list of kids.
|
void |
setNoExport(boolean noExport) |
sets the field to be not exported..
|
void |
setParent(PDField parent) |
Set the parent of this field.
|
void |
setPartialName(java.lang.String name) |
This will set the partial name of the field.
|
void |
setReadonly(boolean readonly) |
sets the field to be read-only.
|
void |
setRequired(boolean required) |
sets the field to be required.
|
abstract void |
setValue(java.lang.String value) |
setValue sets the fields value to a given string.
|
java.lang.String |
toString() |
This will return a string representation of this field.
|
public static final int FLAG_READ_ONLY
public static final int FLAG_REQUIRED
public static final int FLAG_NO_EXPORT
public PDField(PDAcroForm theAcroForm)
theAcroForm
- The form that this field is part of.public PDField(PDAcroForm theAcroForm, COSDictionary field)
theAcroForm
- The form that this field is part of.field
- the PDF objet to represent as a field.public java.lang.String getPartialName()
public void setPartialName(java.lang.String name)
name
- The new name for the field.public java.lang.String getFullyQualifiedName() throws java.io.IOException
java.io.IOException
- If there is an error generating the fully qualified name.public java.lang.String getAlternateFieldName()
public void setAlternateFieldName(java.lang.String alternateFieldName)
alternateFieldName
- the alternate name of the fieldpublic java.lang.String getFieldType()
findFieldType()
public java.lang.String findFieldType()
public abstract void setValue(java.lang.String value) throws java.io.IOException
value
- the string valuejava.io.IOException
- If there is an error creating the appearance stream.public abstract java.lang.String getValue() throws java.io.IOException
java.io.IOException
- If there is an error getting the value.public void setReadonly(boolean readonly)
readonly
- The new flag for readonly.public boolean isReadonly()
public void setRequired(boolean required)
required
- The new flag for required.public boolean isRequired()
public void setNoExport(boolean noExport)
noExport
- The new flag for noExport.public boolean isNoExport()
public int getFieldFlags()
public void setFieldFlags(int flags)
flags
- The new flags.public void importFDF(FDFField fdfField) throws java.io.IOException
fdfField
- The fdf field to import.java.io.IOException
- If there is an error importing the data for this field.public PDAnnotationWidget getWidget() throws java.io.IOException
getWidgets()
. If the kids entry is specified, then only first
entry in that list will be returned.java.io.IOException
- If there is an error getting the widget object.public java.util.List<PDAnnotationWidget> getWidgets()
public PDField getParent() throws java.io.IOException
java.io.IOException
- If there is an error creating the parent field.public void setParent(PDField parent)
parent
- The parent to this field.public PDField findKid(java.lang.String[] name, int nameIndex) throws java.io.IOException
name
- An array that picks the path to the field.nameIndex
- The index into the array.java.io.IOException
- If there is an error creating the field.public java.util.List<COSObjectable> getKids() throws java.io.IOException
java.io.IOException
- If there is an error retrieving the kids.public void setKids(java.util.List<COSObjectable> kids)
kids
- The list of child widgets.public java.lang.String toString()
toString
in class java.lang.Object
public PDAcroForm getAcroForm()
public void setAcroForm(PDAcroForm value)
value
- The new form to use.public COSDictionary getDictionary()
public COSBase getCOSObject()
getCOSObject
in interface COSObjectable
public PDFormFieldAdditionalActions getActions()
public void setActions(PDFormFieldAdditionalActions actions)
actions
- The field actions.protected void setFieldType(java.lang.String fieldType)
fieldType
- the field type string must be one of "Btn", "Ch", "Tx", "Sig"