Package com.itextpdf.kernel.pdf.annot
Class PdfWidgetAnnotation
java.lang.Object
com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
com.itextpdf.kernel.pdf.annot.PdfAnnotation
com.itextpdf.kernel.pdf.annot.PdfWidgetAnnotation
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
Fields inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
Accepted, Canceled, Completed, HIGHLIGHT_INVERT, HIGHLIGHT_NONE, HIGHLIGHT_OUTLINE, HIGHLIGHT_PUSH, HIGHLIGHT_TOGGLE, INVISIBLE, LOCKED, LOCKED_CONTENTS, Marked, MarkedModel, NO_ROTATE, NO_VIEW, NO_ZOOM, None, page, PRINT, READ_ONLY, Rejected, ReviewModel, STYLE_BEVELED, STYLE_DASHED, STYLE_INSET, STYLE_SOLID, STYLE_UNDERLINE, TOGGLE_NO_VIEW, Unmarked
-
Constructor Summary
ModifierConstructorDescriptionPdfWidgetAnnotation
(Rectangle rect) protected
PdfWidgetAnnotation
(PdfDictionary pdfObject) Instantiates a newPdfWidgetAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document. -
Method Summary
Modifier and TypeMethodDescriptionAnPdfAction
to perform, such as launching an application, playing a sound, changing an annotation’s appearance state etc, when the annotation is activated.An additional actions dictionary that extends the set of events that can trigger the execution of an action.An appearance characteristics dictionary containing additional information for constructing the annotation’s appearance stream.The dictionaries for some annotation types (such as free text and polygon annotations) can include the BS entry.Getter for the annotation's highlighting mode.Gets aPdfName
which value is a subtype of this annotation.void
Remove widget annotation from AcroForm hierarchy.Sets aPdfAction
to this annotation which will be performed when the annotation is activated.setAdditionalAction
(PdfName key, PdfAction action) Sets an additionalPdfAction
to this annotation which will be performed in response to the specific trigger event defined bykey
.setAppearanceCharacteristics
(PdfDictionary characteristics) Sets an appearance characteristics dictionary containing additional information for constructing the annotation’s appearance stream.setBorderStyle
(PdfDictionary borderStyle) Sets border style dictionary that has more settings than the array specified for the Border entry (PdfAnnotation.getBorder()
).setBorderStyle
(PdfName style) Setter for the annotation's preset border style.setDashPattern
(PdfArray dashPattern) Setter for the annotation's preset dashed border style.setHighlightMode
(PdfName mode) Setter for the annotation's highlighting mode.setVisibility
(int visibility) Set the visibility flags of the Widget annotation Options are: HIDDEN, HIDDEN_BUT_PRINTABLE, VISIBLE, VISIBLE_BUT_DOES_NOT_PRINTMethods inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
addAssociatedFile, flush, getAppearanceDictionary, getAppearanceObject, getAppearanceState, getAssociatedFiles, getBlendMode, getBorder, getColorObject, getContents, getDate, getDownAppearanceObject, getFlags, getLang, getName, getNonStrokingOpacity, getNormalAppearanceObject, getPage, getPageObject, getRectangle, getRolloverAppearanceObject, getStrokingOpacity, getStructParentIndex, getTitle, hasFlag, isWrappedObjectMustBeIndirect, makeAnnotation, put, remove, resetFlag, setAppearance, setAppearance, setAppearanceState, setBlendMode, setBorder, setBorder, setColor, setColor, setColor, setContents, setContents, setDate, setDownAppearance, setDownAppearance, setFlag, setFlags, setLang, setLayer, setName, setNonStrokingOpacity, setNormalAppearance, setNormalAppearance, setPage, setRectangle, setRolloverAppearance, setRolloverAppearance, setStrokingOpacity, setStructParentIndex, setTitle
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Field Details
-
HIDDEN
public static final int HIDDEN- See Also:
-
VISIBLE_BUT_DOES_NOT_PRINT
public static final int VISIBLE_BUT_DOES_NOT_PRINT- See Also:
-
HIDDEN_BUT_PRINTABLE
public static final int HIDDEN_BUT_PRINTABLE- See Also:
-
VISIBLE
public static final int VISIBLE- See Also:
-
-
Constructor Details
-
PdfWidgetAnnotation
-
PdfWidgetAnnotation
Instantiates a newPdfWidgetAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.- Parameters:
-
pdfObject
- thePdfDictionary
representing annotation object - See Also:
-
-
Method Details
-
getSubtype
Description copied from class:PdfAnnotation
Gets aPdfName
which value is a subtype of this annotation. See ISO-320001 12.5.6, "Annotation Types" for the reference to the possible types.- Specified by:
-
getSubtype
in classPdfAnnotation
- Returns:
- subtype of this annotation.
-
setParent
-
setHighlightMode
Setter for the annotation's highlighting mode. Possible values arePdfAnnotation.HIGHLIGHT_NONE
- No highlighting.PdfAnnotation.HIGHLIGHT_INVERT
- Invert the contents of the annotation rectangle.PdfAnnotation.HIGHLIGHT_OUTLINE
- Invert the annotation's border.PdfAnnotation.HIGHLIGHT_PUSH
- Display the annotation?s down appearance, if any.PdfAnnotation.HIGHLIGHT_TOGGLE
- Same as P.
- Parameters:
-
mode
- The new value for the annotation's highlighting mode. - Returns:
- The widget annotation which this method was called on.
-
getHighlightMode
Getter for the annotation's highlighting mode.- Returns:
- Current value of the annotation's highlighting mode.
-
releaseFormFieldFromWidgetAnnotation
public void releaseFormFieldFromWidgetAnnotation()Remove widget annotation from AcroForm hierarchy. -
setVisibility
Set the visibility flags of the Widget annotation Options are: HIDDEN, HIDDEN_BUT_PRINTABLE, VISIBLE, VISIBLE_BUT_DOES_NOT_PRINT- Parameters:
-
visibility
- visibility option - Returns:
- the edited widget annotation
-
getAction
AnPdfAction
to perform, such as launching an application, playing a sound, changing an annotation’s appearance state etc, when the annotation is activated.- Returns:
-
PdfDictionary
which defines the characteristics and behaviour of an action.
-
setAction
Sets aPdfAction
to this annotation which will be performed when the annotation is activated.- Parameters:
-
action
-PdfAction
to set to this annotation. - Returns:
-
this
PdfWidgetAnnotation
instance.
-
getAdditionalAction
An additional actions dictionary that extends the set of events that can trigger the execution of an action. See ISO-320001 12.6.3 Trigger Events.- Returns:
-
an additional actions
PdfDictionary
. - See Also:
-
setAdditionalAction
Sets an additionalPdfAction
to this annotation which will be performed in response to the specific trigger event defined bykey
. See ISO-320001 12.6.3, "Trigger Events".- Parameters:
-
key
- aPdfName
that denotes a type of the additional action to set. -
action
-PdfAction
to set as additional to this annotation. - Returns:
-
this
PdfWidgetAnnotation
instance.
-
getAppearanceCharacteristics
An appearance characteristics dictionary containing additional information for constructing the annotation’s appearance stream. See ISO-320001, Table 189.- Returns:
- an appearance characteristics dictionary or null if it isn't specified.
-
setAppearanceCharacteristics
Sets an appearance characteristics dictionary containing additional information for constructing the annotation’s appearance stream. See ISO-320001, Table 189.- Parameters:
-
characteristics
- thePdfDictionary
with additional information for appearance stream. - Returns:
-
this
PdfWidgetAnnotation
instance.
-
getBorderStyle
The dictionaries for some annotation types (such as free text and polygon annotations) can include the BS entry. That entry specifies a border style dictionary that has more settings than the array specified for the Border entry (seePdfAnnotation.getBorder()
). If an annotation dictionary includes the BS entry, then the Border entry is ignored. If annotation includes AP (seePdfAnnotation.getAppearanceDictionary()
) it takes precedence over the BS entry. For more info on BS entry see ISO-320001, Table 166.- Returns:
-
PdfDictionary
which is a border style dictionary or null if it is not specified.
-
setBorderStyle
Sets border style dictionary that has more settings than the array specified for the Border entry (PdfAnnotation.getBorder()
). See ISO-320001, Table 166 andgetBorderStyle()
for more info.- Parameters:
-
borderStyle
- a border style dictionary specifying the line width and dash pattern that shall be used in drawing the annotation’s border. - Returns:
-
this
PdfWidgetAnnotation
instance.
-
setBorderStyle
Setter for the annotation's preset border style. Possible values arePdfAnnotation.STYLE_SOLID
- A solid rectangle surrounding the annotation.PdfAnnotation.STYLE_DASHED
- A dashed rectangle surrounding the annotation.PdfAnnotation.STYLE_BEVELED
- A simulated embossed rectangle that appears to be raised above the surface of the page.PdfAnnotation.STYLE_INSET
- A simulated engraved rectangle that appears to be recessed below the surface of the page.PdfAnnotation.STYLE_UNDERLINE
- A single line along the bottom of the annotation rectangle.
- Parameters:
-
style
- The new value for the annotation's border style. - Returns:
-
this
PdfWidgetAnnotation
instance. - See Also:
-
setDashPattern
Setter for the annotation's preset dashed border style. This property has affect only ifPdfAnnotation.STYLE_DASHED
style was used for the annotation border style (seesetBorderStyle(PdfName)
. See ISO-320001 8.4.3.6, "Line Dash Pattern" for the format in which dash pattern shall be specified.- Parameters:
-
dashPattern
- a dash array defining a pattern of dashes and gaps that shall be used in drawing a dashed border. - Returns:
-
this
PdfWidgetAnnotation
instance.
-