public abstract class AbstractPdfFormField extends PdfObjectWrapper<PdfDictionary>
AcroForm.
To be able to be wrapped with this PdfObjectWrapper the PdfObject
must be indirect.
| Modifier and Type | Field and Description |
|---|---|
protected Color |
color |
static int |
DEFAULT_FONT_SIZE
Size of text in form fields when font size is not explicitly set.
|
protected PdfFont |
font |
protected float |
fontSize |
static int |
MIN_FONT_SIZE
Minimal size of text in form fields.
|
protected PdfFormField |
parent
Parent form field.
|
protected PdfConformance |
pdfConformance |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPdfFormField(PdfDictionary pdfObject)
Creates a form field as a wrapper object around a
PdfDictionary. |
| Modifier and Type | Method and Description |
|---|---|
void |
disableCurrentFieldRegeneration()
This method disables regeneration of the current field appearance stream.
|
void |
disableFieldRegeneration()
This method disables regeneration of the field and its children appearance stream.
|
void |
enableCurrentFieldRegeneration()
This method enables regeneration of the current field appearance stream and regenerates it.
|
void |
enableFieldRegeneration()
This method enables regeneration of the field appearance stream.
|
boolean |
equals(Object o)
Indicate whether some other object is "equal to" this one.
|
abstract String[] |
getAppearanceStates()
Gets the appearance state names.
|
Color |
getColor()
Gets the current color of the form field.
|
abstract PdfString |
getDefaultAppearance()
Gets default appearance string containing a sequence of valid page-content graphics or text state operators that
define such properties as the field's text size and color.
|
PdfDocument |
getDocument()
Gets the
PdfDocument that owns that form field. |
PdfString |
getFieldName()
Gets the current field name.
|
PdfFont |
getFont()
Gets the current font of the form field.
|
float |
getFontSize()
Gets the current fontSize of the form field.
|
PdfDictionary |
getParent()
Gets the parent dictionary.
|
PdfFormField |
getParentField()
Gets the parent field.
|
PdfConformance |
getPdfConformance()
Gets the declared conformance.
|
PdfDictionary |
getPdfObject()
Gets the wrapped dictionary.
|
int |
hashCode()
Generate a hash code for this object.
|
boolean |
isFieldRegenerationEnabled()
This method checks if field appearance stream regeneration is enabled.
|
boolean |
isTerminalFormField()
Determines whether current form field is terminal or not.
|
protected boolean |
isWrappedObjectMustBeIndirect() |
AbstractPdfFormField |
put(PdfName key,
PdfObject value)
Inserts the value into the
PdfDictionary of this field and associates it with the specified key. |
abstract boolean |
regenerateField()
This method regenerates appearance stream of the field.
|
void |
release()
Releases underlying pdf object and other pdf entities used by wrapper.
|
AbstractPdfFormField |
remove(PdfName key)
Removes the specified key from the
PdfDictionary of this field. |
AbstractPdfFormField |
setColor(Color color)
Sets the text color and regenerates appearance stream.
|
AbstractPdfFormField |
setFont(PdfFont font)
Basic setter for the
font property. |
AbstractPdfFormField |
setFontAndSize(PdfFont font,
float fontSize)
Combined setter for the
font and fontSize
properties. |
AbstractPdfFormField |
setFontSize(float fontSize)
Basic setter for the
fontSize property. |
AbstractPdfFormField |
setFontSize(int fontSize)
Basic setter for the
fontSize property. |
AbstractPdfFormField |
setFontSizeAutoScale()
Sets zero font size which will be interpreted as auto-size according to ISO 32000-1, 12.7.3.3.
|
void |
setParent(PdfFormField parent)
Sets a parent
PdfFormField for the current object. |
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, flush, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidReleasepublic static final int DEFAULT_FONT_SIZE
public static final int MIN_FONT_SIZE
protected PdfFont font
protected float fontSize
protected Color color
protected PdfConformance pdfConformance
protected PdfFormField parent
protected AbstractPdfFormField(PdfDictionary pdfObject)
PdfDictionary.
This PdfDictionary must be an indirect object.pdfObject - the dictionary to be wrapped, must have an indirect reference.public PdfDictionary getPdfObject()
getPdfObject in class PdfObjectWrapper<PdfDictionary>public void setParent(PdfFormField parent)
PdfFormField for the current object.parent - another form field that this field belongs to, usually a group field.public PdfDictionary getParent()
public PdfFormField getParentField()
public PdfString getFieldName()
PdfString.public abstract PdfString getDefaultAppearance()
PdfString.public float getFontSize()
public Color getColor()
colorpublic PdfConformance getPdfConformance()
PdfConformancepublic abstract boolean regenerateField()
public void disableFieldRegeneration()
Note that after this method is called field will be regenerated
only during enableFieldRegeneration() call.
public void enableFieldRegeneration()
Should be called after disableFieldRegeneration() method call.
public void disableCurrentFieldRegeneration()
public void enableCurrentFieldRegeneration()
public boolean isFieldRegenerationEnabled()
public abstract String[] getAppearanceStates()
public AbstractPdfFormField put(PdfName key, PdfObject value)
PdfDictionary of this field and associates it with the specified key.
If the key is already present in this field dictionary,
this method will override the old value with the specified one.key - key to insert or to override.value - the value to associate with the specified key.public AbstractPdfFormField remove(PdfName key)
PdfDictionary of this field.key - key to be removed.public void release()
PdfObject.release() if the wrapper is used.public PdfDocument getDocument()
PdfDocument that owns that form field.PdfDocument that owns that form field.protected boolean isWrappedObjectMustBeIndirect()
isWrappedObjectMustBeIndirect in class PdfObjectWrapper<PdfDictionary>public AbstractPdfFormField setColor(Color color)
color - the new value for the Color.AbstractPdfFormField.public AbstractPdfFormField setFont(PdfFont font)
font property. Regenerates the field
appearance after setting the new value.
Note that the font will be added to the document so ensure that the font is embedded
if it's a pdf/a document.font - The new font to be set.AbstractPdfFormField.public AbstractPdfFormField setFontSize(float fontSize)
fontSize property. Regenerates the
field appearance after setting the new value.fontSize - The new font size to be set.AbstractPdfFormField.public AbstractPdfFormField setFontSize(int fontSize)
fontSize property. Regenerates the
field appearance after setting the new value.fontSize - The new font size to be set.AbstractPdfFormField.public AbstractPdfFormField setFontSizeAutoScale()
AbstractPdfFormField.public AbstractPdfFormField setFontAndSize(PdfFont font, float fontSize)
font and fontSize
properties. Regenerates the field appearance after setting the new value.font - The new font to be set.fontSize - The new font size to be set.AbstractPdfFormField.public boolean isTerminalFormField()
public boolean equals(Object o)
Copyright © 1998–2025 Apryse Group NV. All rights reserved.