public class PdfFormAnnotation extends AbstractPdfFormField
AcroForm.
To be able to be wrapped with this PdfObjectWrapper the PdfObject
must be indirect.
| Modifier and Type | Field and Description |
|---|---|
protected Color |
backgroundColor |
protected Color |
borderColor |
protected float |
borderWidth |
static int |
HIDDEN |
static int |
HIDDEN_BUT_PRINTABLE |
static String |
OFF_STATE_VALUE
Value which represents "off" state of form field.
|
static String |
ON_STATE_VALUE
Value which represents "on" state of form field.
|
static int |
VISIBLE |
static int |
VISIBLE_BUT_DOES_NOT_PRINT |
color, DEFAULT_FONT_SIZE, font, fontSize, MIN_FONT_SIZE, parent, pdfAConformanceLevel, pdfConformanceLevel| Modifier | Constructor and Description |
|---|---|
protected |
PdfFormAnnotation(PdfDictionary pdfObject)
Creates a form field annotation as a wrapper object around a
PdfDictionary. |
protected |
PdfFormAnnotation(PdfWidgetAnnotation widget,
PdfDocument pdfDocument)
Creates a form field annotation as a wrapper of a
PdfWidgetAnnotation. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
drawBorder(PdfCanvas canvas,
PdfFormXObject xObject,
float width,
float height)
Draws a border using the borderWidth and borderColor of the form field.
|
protected void |
drawCheckBoxAndSaveAppearance(String onStateName)
Draw a checkbox and save its appearance.
|
protected void |
drawComboBoxAndSaveAppearance()
Draws the appearance of a Combo box form field and saves it into an appearance stream.
|
protected void |
drawListFormFieldAndSaveAppearance()
Draws the appearance of a list box form field and saves it into an appearance stream.
|
protected void |
drawPushButtonFieldAndSaveAppearance()
Draws the appearance of a push button and saves it into an appearance stream.
|
protected void |
drawRadioButtonAndSaveAppearance(String value)
Draws the appearance of a radio button with a specified value and saves it into an appearance stream.
|
protected void |
drawSignatureFormFieldAndSaveAppearance()
Draws the appearance of a signature field and saves it into an appearance stream.
|
protected void |
drawTextFormFieldAndSaveAppearance()
Draws the appearance of a text form field and saves it into an appearance stream.
|
String[] |
getAppearanceStates()
Gets the appearance state names.
|
Border |
getBorder()
Get border object specified in the widget annotation dictionary.
|
float |
getBorderWidth()
Gets the border width for the field.
|
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.
|
protected Rectangle |
getRect(PdfDictionary field)
Gets a
Rectangle that matches the current size and position of this form field. |
int |
getRotation()
Get rotation property specified in this form annotation.
|
PdfWidgetAnnotation |
getWidget()
Gets
PdfWidgetAnnotation that this form field refers to. |
static PdfFormAnnotation |
makeFormAnnotation(PdfObject pdfObject,
PdfDocument document)
Creates a
PdfFormAnnotation object. |
boolean |
regenerateField()
This method regenerates appearance stream of the field.
|
PdfFormAnnotation |
setAction(PdfAction action)
Sets the action on
widget of this annotation form field. |
PdfFormAnnotation |
setAppearance(PdfName appearanceType,
String appearanceState,
PdfStream appearanceStream)
Sets an appearance for (the widgets related to) the form field.
|
PdfFormAnnotation |
setBackgroundColor(Color backgroundColor)
Basic setter for the
backgroundColor property. |
PdfFormAnnotation |
setBorderColor(Color color)
Sets the Border Color.
|
PdfFormAnnotation |
setBorderStyle(PdfDictionary style)
Sets the border style for the field.
|
PdfFormAnnotation |
setBorderWidth(float borderWidth)
Sets the border width for the field.
|
PdfFormAnnotation |
setCaption(String caption)
Basic setter for the push button caption.
|
PdfFormAnnotation |
setCaption(String caption,
boolean regenerateField)
Basic setter for the push button caption.
|
PdfFormAnnotation |
setCheckBoxAppearanceOnStateName(String onStateName)
Sets on state name for the checkbox annotation normal appearance and regenerates widget.
|
PdfFormAnnotation |
setFormFieldElement(IFormField element)
This method sets the model element associated with the current annotation and can be useful to take into account
when drawing those properties that the annotation does not have.
|
PdfFormAnnotation |
setPage(int pageNum)
Specifies on which page the form field's widget must be shown.
|
PdfFormAnnotation |
setRotation(int degRotation)
Basic setter for the
degRotation property. |
PdfFormAnnotation |
setVisibility(int visibility)
Set the visibility flags of the form field annotation.
|
disableCurrentFieldRegeneration, disableFieldRegeneration, enableCurrentFieldRegeneration, enableFieldRegeneration, equals, getColor, getDocument, getFieldName, getFont, getFontSize, getParent, getParentField, getPdfAConformanceLevel, getPdfConformanceLevel, getPdfObject, hashCode, isFieldRegenerationEnabled, isTerminalFormField, isWrappedObjectMustBeIndirect, put, release, remove, setColor, setFont, setFontAndSize, setFontSize, setFontSize, setFontSizeAutoScale, setParentensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, flush, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidReleasepublic static final int HIDDEN
public static final int VISIBLE_BUT_DOES_NOT_PRINT
public static final int HIDDEN_BUT_PRINTABLE
public static final int VISIBLE
public static final String OFF_STATE_VALUE
public static final String ON_STATE_VALUE
protected float borderWidth
protected Color backgroundColor
protected Color borderColor
protected PdfFormAnnotation(PdfWidgetAnnotation widget, PdfDocument pdfDocument)
PdfWidgetAnnotation.widget - The widget which will be a kid of the PdfFormFieldpdfDocument - The PdfDocument instance.protected PdfFormAnnotation(PdfDictionary pdfObject)
PdfDictionary.
This PdfDictionary must be an indirect object.pdfObject - the dictionary to be wrapped, must have an indirect reference.public static PdfFormAnnotation makeFormAnnotation(PdfObject pdfObject, PdfDocument document)
PdfFormAnnotation object.pdfObject - assumed to be either a PdfDictionary, or a
PdfIndirectReference to a PdfDictionary.document - the PdfDocument to create the field in.PdfFormAnnotation, or null if
pdfObject is not a widget annotation.public PdfWidgetAnnotation getWidget()
PdfWidgetAnnotation that this form field refers to.PdfWidgetAnnotation.public PdfString getDefaultAppearance()
getDefaultAppearance in class AbstractPdfFormFieldPdfString.public boolean regenerateField()
regenerateField in class AbstractPdfFormFieldpublic String[] getAppearanceStates()
getAppearanceStates in class AbstractPdfFormFieldpublic PdfFormAnnotation setBackgroundColor(Color backgroundColor)
backgroundColor property. Regenerates
the field appearance after setting the new value.backgroundColor - The new color to be set or null if no background needed.PdfFormAnnotation.public PdfFormAnnotation setCaption(String caption)
caption - button caption to be set.PdfFormAnnotation.public PdfFormAnnotation setCaption(String caption, boolean regenerateField)
caption - button caption to be set.regenerateField - true if field should be regenerated, false otherwise.PdfFormAnnotation.public int getRotation()
int value which represents field's rotationpublic PdfFormAnnotation setRotation(int degRotation)
degRotation property. Regenerates
the field appearance after setting the new value.degRotation - The new degRotation to be setPdfFormAnnotation.public PdfFormAnnotation setAction(PdfAction action)
widget of this annotation form field.action - The action.PdfFormAnnotation.public PdfFormAnnotation setVisibility(int visibility)
visibility - visibility option.PdfFormAnnotation.public float getBorderWidth()
public PdfFormAnnotation setBorderWidth(float borderWidth)
borderWidth - The new border width.PdfFormAnnotation.public Border getBorder()
Border specified in the widget annotation dictionarypublic PdfFormAnnotation setBorderStyle(PdfDictionary style)
style - the new border style.PdfFormAnnotation.public PdfFormAnnotation setBorderColor(Color color)
color - the new value for the Border Color.PdfFormAnnotation.public PdfFormAnnotation setPage(int pageNum)
pageNum - the page number.PdfFormAnnotation.public PdfFormAnnotation setFormFieldElement(IFormField element)
Also note that the model element won't be used for annotations for choice form field.
element - model element to set.PdfFormAnnotation.public PdfFormAnnotation setAppearance(PdfName appearanceType, String appearanceState, PdfStream appearanceStream)
appearanceType - the type of appearance stream to be added
appearanceState - the state of the form field that needs to be true
for the appearance to be used. Differentiates between several streams
of the same type.appearanceStream - the appearance instructions, as a PdfStream.PdfFormAnnotation.public PdfFormAnnotation setCheckBoxAppearanceOnStateName(String onStateName)
onStateName - the new appearance name representing on state.PdfFormAnnotation.protected Rectangle getRect(PdfDictionary field)
Rectangle that matches the current size and position of this form field.field - current form field.Rectangle that matches the current size and position of this form field
annotation.protected void drawBorder(PdfCanvas canvas, PdfFormXObject xObject, float width, float height)
canvas - The PdfCanvas on which to drawxObject - The PdfFormXObjectwidth - The width of the rectangle to drawheight - The height of the rectangle to drawprotected void drawPushButtonFieldAndSaveAppearance()
protected void drawSignatureFormFieldAndSaveAppearance()
protected void drawRadioButtonAndSaveAppearance(String value)
value - the value of the radio button.protected void drawListFormFieldAndSaveAppearance()
protected void drawTextFormFieldAndSaveAppearance()
protected void drawComboBoxAndSaveAppearance()
protected void drawCheckBoxAndSaveAppearance(String onStateName)
onStateName - the name of the appearance state for the checked stateCopyright © 1998–2024 Apryse Group NV. All rights reserved.