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
-
public class PdfWidgetAnnotation extends PdfAnnotation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
PdfAnnotation.PdfUnknownAnnotation
-
-
Field Summary
Fields Modifier and Type Field Description static int
HIDDEN
static int
HIDDEN_BUT_PRINTABLE
static int
VISIBLE
static int
VISIBLE_BUT_DOES_NOT_PRINT
-
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
Constructors Modifier Constructor Description PdfWidgetAnnotation(Rectangle rect)
protected
PdfWidgetAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfWidgetAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfDictionary
getAction()
AnPdfAction
to perform, such as launching an application, playing a sound, changing an annotation’s appearance state etc, when the annotation is activated.PdfDictionary
getAdditionalAction()
An additional actions dictionary that extends the set of events that can trigger the execution of an action.PdfDictionary
getAppearanceCharacteristics()
An appearance characteristics dictionary containing additional information for constructing the annotation’s appearance stream.PdfDictionary
getBorderStyle()
The dictionaries for some annotation types (such as free text and polygon annotations) can include the BS entry.PdfName
getHighlightMode()
Getter for the annotation's highlighting mode.PdfName
getSubtype()
Gets aPdfName
which value is a subtype of this annotation.void
releaseFormFieldFromWidgetAnnotation()
Remove widget annotation from AcroForm hierarchy.PdfWidgetAnnotation
setAction(PdfAction action)
Sets aPdfAction
to this annotation which will be performed when the annotation is activated.PdfWidgetAnnotation
setAdditionalAction(PdfName key, PdfAction action)
Sets an additionalPdfAction
to this annotation which will be performed in response to the specific trigger event defined bykey
.PdfWidgetAnnotation
setAppearanceCharacteristics(PdfDictionary characteristics)
Sets an appearance characteristics dictionary containing additional information for constructing the annotation’s appearance stream.PdfWidgetAnnotation
setBorderStyle(PdfDictionary borderStyle)
Sets border style dictionary that has more settings than the array specified for the Border entry (PdfAnnotation.getBorder()
).PdfWidgetAnnotation
setBorderStyle(PdfName style)
Setter for the annotation's preset border style.PdfWidgetAnnotation
setDashPattern(PdfArray dashPattern)
Setter for the annotation's preset dashed border style.PdfWidgetAnnotation
setHighlightMode(PdfName mode)
Setter for the annotation's highlighting mode.PdfWidgetAnnotation
setParent(PdfObject parent)
PdfWidgetAnnotation
setVisibility(int visibility)
Set the visibility flags of the Widget annotation Options are: HIDDEN, HIDDEN_BUT_PRINTABLE, VISIBLE, VISIBLE_BUT_DOES_NOT_PRINT-
Methods 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 Detail
-
HIDDEN
public static final int HIDDEN
- See Also:
- Constant Field Values
-
VISIBLE_BUT_DOES_NOT_PRINT
public static final int VISIBLE_BUT_DOES_NOT_PRINT
- See Also:
- Constant Field Values
-
HIDDEN_BUT_PRINTABLE
public static final int HIDDEN_BUT_PRINTABLE
- See Also:
- Constant Field Values
-
VISIBLE
public static final int VISIBLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PdfWidgetAnnotation
public PdfWidgetAnnotation(Rectangle rect)
-
PdfWidgetAnnotation
protected PdfWidgetAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfWidgetAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.- Parameters:
pdfObject
- thePdfDictionary
representing annotation object- See Also:
PdfAnnotation.makeAnnotation(PdfObject)
-
-
Method Detail
-
getSubtype
public PdfName 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
public PdfWidgetAnnotation setParent(PdfObject parent)
-
setHighlightMode
public PdfWidgetAnnotation setHighlightMode(PdfName mode)
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
public PdfName 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
public PdfWidgetAnnotation setVisibility(int visibility)
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
public PdfDictionary 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
public PdfWidgetAnnotation setAction(PdfAction action)
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
public PdfDictionary 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:
getAction()
-
setAdditionalAction
public PdfWidgetAnnotation setAdditionalAction(PdfName key, PdfAction action)
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
public PdfDictionary 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
public PdfWidgetAnnotation setAppearanceCharacteristics(PdfDictionary characteristics)
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
public PdfDictionary 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
public PdfWidgetAnnotation setBorderStyle(PdfDictionary borderStyle)
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
public PdfWidgetAnnotation setBorderStyle(PdfName style)
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:
getBorderStyle()
-
setDashPattern
public PdfWidgetAnnotation setDashPattern(PdfArray dashPattern)
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.
-
-