Package com.itextpdf.kernel.pdf.annot
Class PdfAnnotation
- Direct Known Subclasses:
-
Pdf3DAnnotation,PdfLinkAnnotation,PdfMarkupAnnotation,PdfPopupAnnotation,PdfPrinterMarkAnnotation,PdfScreenAnnotation,PdfTrapNetworkAnnotation,PdfWatermarkAnnotation,PdfWidgetAnnotation
This is a super class for the annotation dictionary wrappers. Derived classes represent different standard types of annotations. See ISO-320001 12.5.6, "Annotation Types."
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PdfStringAnnotation state.static final PdfStringAnnotation state.static final PdfStringAnnotation state.static final intAnnotation flag.static final PdfNameWidget annotation highlighting mode.static final PdfNameWidget annotation highlighting mode.static final PdfNameWidget annotation highlighting mode.static final PdfNameWidget annotation highlighting mode.static final PdfNameWidget annotation highlighting mode.static final intAnnotation flag.static final intAnnotation flag.static final intAnnotation flag.static final PdfStringAnnotation state.static final PdfStringAnnotation state model.static final intAnnotation flag.static final intAnnotation flag.static final intAnnotation flag.static final PdfStringAnnotation state.protected PdfPagestatic final intAnnotation flag.static final intAnnotation flag.static final PdfStringAnnotation state.static final PdfStringAnnotation state model.static final PdfNameAnnotation border style.static final PdfNameAnnotation border style.static final PdfNameAnnotation border style.static final PdfNameAnnotation border style.static final PdfNameAnnotation border style.static final intAnnotation flag.static final PdfStringAnnotation state. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPdfAnnotation(Rectangle rect) protectedPdfAnnotation(PdfDictionary pdfObject) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds file associated with PDF annotation and identifies the relationship between them.voidflush()To manually flush aPdfObjectbehind this wrapper, you have to ensure that this object is added to the document, i.e.An appearance dictionary specifying how the annotation shall be presented visually on the page during its interactions with the user (see ISO-320001 12.5.5, "Appearance Streams").getAppearanceObject(PdfName appearanceType) Specific appearance object corresponding to the specific appearance type.The annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary if there is such.getAssociatedFiles(boolean create) Returns files associated with PDF annotation.PDF 2.0.An array specifying the characteristics of the annotation’s border.An array of numbers in the range 0.0 to 1.0, representing a colour used for the following purposes: The background of the annotation’s icon when closed The title bar of the annotation’s pop-up window The border of a link annotation The number of array elements determines the colour space in which the colour shall be defined: 0 - No colour; transparent 1 - DeviceGray 3 - DeviceRGB 4 - DeviceCMYKGets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.getDate()The date and time when the annotation was most recently modified.The down appearance is used when the mouse button is pressed or held down within the annotation’s active area.intgetFlags()A set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags").getLang()PDF 2.0.getName()Gets the annotation name, a text string uniquely identifying it among all the annotations on its page.floatPDF 2.0.The normal appearance is used when the annotation is not interacting with the user.getPage()Gets aPdfPageon which annotation is placed.Gets aPdfDictionarythat represents a page of the document on which annotation is placed, i.e.The annotation rectangle, defining the location of the annotation on the page in default user space units.The rollover appearance is used when the user moves the cursor into the annotation’s active area without pressing the mouse button.floatPDF 2.0.intThe integer key of the annotation’s entry in the structural parent tree (see ISO-320001 14.7.4.4, "Finding Structure Elements from Content Items").abstract PdfNameGets aPdfNamewhich value is a subtype of this annotation.getTitle()Annotation title.booleanhasFlag(int flag) Checks if the certain flag that specifies a characteristic of the annotation is in enabled state (see ISO-320001 12.5.3, "Annotation Flags").protected booleanDefines if the object behind this wrapper must be an indirect object in the resultant document.static PdfAnnotationmakeAnnotation(PdfObject pdfObject) Factory method that creates the type specificPdfAnnotationfrom the givenPdfObjectthat represents annotation object.Inserts the value into into the underlyingPdfDictionaryof thisPdfAnnotationand associates it with the specified key.Removes the specified key from the underlyingPdfDictionaryof thisPdfAnnotation.resetFlag(int flag) Resets a flag that specifies a characteristic of the annotation to disabled state (see ISO-320001 12.5.3, "Annotation Flags").setAppearance(PdfName appearanceType, PdfAnnotationAppearance appearance) Sets a specific type of the appearance usingPdfAnnotationAppearancewrapper.setAppearance(PdfName appearanceType, PdfDictionary appearance) Sets a specific type of the appearance.Sets the annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary.setBlendMode(PdfName blendMode) PDF 2.0.setBorder(PdfAnnotationBorder border) Sets the characteristics of the annotation’s border.Sets the characteristics of the annotation’s border.setColor(float[] color) Sets an annotation color.Sets an annotation color.Sets an annotation color.setContents(PdfString contents) Sets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.setContents(String contents) Sets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.The date and time when the annotation was most recently modified.setDownAppearance(PdfAnnotationAppearance appearance) Sets down appearance usingPdfAnnotationAppearancewrapper.setDownAppearance(PdfDictionary appearance) Sets down appearance.setFlag(int flag) Sets a flag that specifies a characteristic of the annotation to enabled state (see ISO-320001 12.5.3, "Annotation Flags").setFlags(int flags) Sets a set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags").PDF 2.0.voidSets the layer this annotation belongs to.Sets the annotation name, a text string uniquely identifying it among all the annotations on its page.setNonStrokingOpacity(float nonStrokingOpacity) PDF 2.0.setNormalAppearance(PdfAnnotationAppearance appearance) Sets normal appearance usingPdfAnnotationAppearancewrapper.setNormalAppearance(PdfDictionary appearance) Sets normal appearance.Method that modifies annotation page property, which defines to which page annotation belongs.setRectangle(PdfArray array) The annotation rectangle, defining the location of the annotation on the page in default user space units.setRolloverAppearance(PdfAnnotationAppearance appearance) Sets rollover appearance usingPdfAnnotationAppearancewrapper.setRolloverAppearance(PdfDictionary appearance) Sets rollover appearance.setStrokingOpacity(float strokingOpacity) PDF 2.0.setStructParentIndex(int structParentIndex) Sets he integer key of the annotation’s entry in the structural parent tree (see ISO-320001 14.7.4.4, "Finding Structure Elements from Content Items").Sets annotation title.Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Field Details
-
INVISIBLE
public static final int INVISIBLEAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
HIDDEN
public static final int HIDDENAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
PRINT
public static final int PRINTAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
NO_ZOOM
public static final int NO_ZOOMAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
NO_ROTATE
public static final int NO_ROTATEAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
NO_VIEW
public static final int NO_VIEWAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
READ_ONLY
public static final int READ_ONLYAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
LOCKED
public static final int LOCKEDAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
TOGGLE_NO_VIEW
public static final int TOGGLE_NO_VIEWAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
LOCKED_CONTENTS
public static final int LOCKED_CONTENTSAnnotation flag. See alsosetFlag(int)and ISO-320001, table 165.- See Also:
-
HIGHLIGHT_NONE
Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also seePdfWidgetAnnotation.setHighlightMode(PdfName). -
HIGHLIGHT_INVERT
Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also seePdfWidgetAnnotation.setHighlightMode(PdfName). -
HIGHLIGHT_OUTLINE
Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also seePdfWidgetAnnotation.setHighlightMode(PdfName). -
HIGHLIGHT_PUSH
Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also seePdfWidgetAnnotation.setHighlightMode(PdfName). -
HIGHLIGHT_TOGGLE
Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also seePdfWidgetAnnotation.setHighlightMode(PdfName). -
STYLE_SOLID
Annotation border style. See ISO-320001, Table 166 (S key). -
STYLE_DASHED
Annotation border style. See ISO-320001, Table 166 (S key). -
STYLE_BEVELED
Annotation border style. See ISO-320001, Table 166 (S key). -
STYLE_INSET
Annotation border style. See ISO-320001, Table 166 (S key). -
STYLE_UNDERLINE
Annotation border style. See ISO-320001, Table 166 (S key). -
Marked
Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also seePdfTextAnnotation.setState(PdfString). -
Unmarked
Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also seePdfTextAnnotation.setState(PdfString). -
Accepted
Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also seePdfTextAnnotation.setState(PdfString). -
Rejected
Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also seePdfTextAnnotation.setState(PdfString). -
Canceled
Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also seePdfTextAnnotation.setState(PdfString). -
Completed
Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also seePdfTextAnnotation.setState(PdfString). -
None
Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also seePdfTextAnnotation.setState(PdfString). -
MarkedModel
Annotation state model. See ISO-320001, Table 172 (StateModel key). Also seePdfTextAnnotation.setStateModel(PdfString). -
ReviewModel
Annotation state model. See ISO-320001, Table 172 (StateModel key). Also seePdfTextAnnotation.setStateModel(PdfString). -
page
-
-
Constructor Details
-
PdfAnnotation
-
PdfAnnotation
-
-
Method Details
-
makeAnnotation
Factory method that creates the type specificPdfAnnotationfrom the givenPdfObjectthat represents annotation object. This method is useful for property reading in reading mode or modifying in stamping mode. See derived classes of this class to see possible specific annotation types created.- Parameters:
-
pdfObject- aPdfObjectthat represents annotation in the document. - Returns:
-
created
PdfAnnotation.
-
getSubtype
Gets aPdfNamewhich value is a subtype of this annotation. See ISO-320001 12.5.6, "Annotation Types" for the reference to the possible types.- Returns:
- subtype of this annotation.
-
setLayer
Sets the layer this annotation belongs to.- Parameters:
-
layer- the layer this annotation belongs to
-
getContents
Gets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.- Returns:
- annotation text content.
-
setContents
Sets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.- Parameters:
-
contents- aPdfStringcontaining text content to be set to the annotation. - Returns:
-
this
PdfAnnotationinstance.
-
setContents
Sets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.- Parameters:
-
contents- a javaStringcontaining text content to be set to the annotation. - Returns:
-
this
PdfAnnotationinstance.
-
getPageObject
Gets aPdfDictionarythat represents a page of the document on which annotation is placed, i.e. which has this annotation in it's /Annots array.- Returns:
-
PdfDictionarythat is a page pdf object or null if annotation is not added to the page yet.
-
getPage
Gets aPdfPageon which annotation is placed.- Returns:
-
PdfPageon which annotation is placed or null if annotation is not placed yet.
-
setPage
Method that modifies annotation page property, which defines to which page annotation belongs. Keep in mind that this doesn't actually add an annotation to the page, it should be done viaPdfPage.addAnnotation(PdfAnnotation). Also you don't need to set this property manually, this is done automatically on addition to the page.- Parameters:
-
page- thePdfPageto which annotation will be added. - Returns:
-
this
PdfAnnotationinstance.
-
getName
Gets the annotation name, a text string uniquely identifying it among all the annotations on its page.- Returns:
-
a
PdfStringwith annotation name as it's value or null if name is not specified.
-
setName
Sets the annotation name, a text string uniquely identifying it among all the annotations on its page.- Parameters:
-
name- aPdfStringto be set as annotation name. - Returns:
-
this
PdfAnnotationinstance.
-
getDate
The date and time when the annotation was most recently modified. This is an optional property of the annotation.- Returns:
-
a
PdfStringwith the modification date as it's value or null if date is not specified.
-
setDate
The date and time when the annotation was most recently modified.- Parameters:
-
date- aPdfStringwith date. The format should be a date string as described in ISO-320001 7.9.4, "Dates". - Returns:
-
this
PdfAnnotationinstance.
-
getFlags
public int getFlags()A set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags"). For specific annotation flag constants seesetFlag(int). Default value: 0.- Returns:
- an integer interpreted as one-bit flags specifying various characteristics of the annotation.
-
setFlags
Sets a set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags"). On the contrary fromsetFlag(int), this method sets a complete set of enabled and disabled flags at once. If not set specifically the default value is 0.- Parameters:
-
flags- an integer interpreted as set of one-bit flags specifying various characteristics of the annotation. - Returns:
-
this
PdfAnnotationinstance.
-
setFlag
Sets a flag that specifies a characteristic of the annotation to enabled state (see ISO-320001 12.5.3, "Annotation Flags"). On the contrary fromsetFlags(int), this method sets only specified flags to enabled state, but doesn't disable other flags. Possible flags:INVISIBLE- If set, do not display the annotation if it does not belong to one of the standard annotation types and no annotation handler is available. If clear, display such unknown annotation using an appearance stream specified by its appearance dictionary, if any.HIDDEN- If set, do not display or print the annotation or allow it to interact with the user, regardless of its annotation type or whether an annotation handler is available.PRINT- If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of whether it is displayed on the screen.NO_ZOOM- If set, do not scale the annotation’s appearance to match the magnification of the page. The location of the annotation on the page (defined by the upper-left corner of its annotation rectangle) shall remain fixed, regardless of the page magnification.}NO_ROTATE- If set, do not rotate the annotation’s appearance to match the rotation of the page. The upper-left corner of the annotation rectangle shall remain in a fixed location on the page, regardless of the page rotation.NO_VIEW- If set, do not display the annotation on the screen or allow it to interact with the user. The annotation may be printed (depending on the setting of the Print flag) but should be considered hidden for purposes of on-screen display and user interaction.READ_ONLY- If set, do not allow the annotation to interact with the user. The annotation may be displayed or printed (depending on the settings of the NoView and Print flags) but should not respond to mouse clicks or change its appearance in response to mouse motions.LOCKED- If set, do not allow the annotation to be deleted or its properties (including position and size) to be modified by the user. However, this flag does not restrict changes to the annotation’s contents, such as the value of a form field.TOGGLE_NO_VIEW- If set, invert the interpretation of the NoView flag for certain events.LOCKED_CONTENTS- If set, do not allow the contents of the annotation to be modified by the user. This flag does not restrict deletion of the annotation or changes to other annotation properties, such as position and size.
- Parameters:
-
flag- - an integer interpreted as set of one-bit flags which will be enabled for this annotation. - Returns:
-
this
PdfAnnotationinstance.
-
resetFlag
Resets a flag that specifies a characteristic of the annotation to disabled state (see ISO-320001 12.5.3, "Annotation Flags").- Parameters:
-
flag- an integer interpreted as set of one-bit flags which will be reset to disabled state. - Returns:
-
this
PdfAnnotationinstance.
-
hasFlag
public boolean hasFlag(int flag) Checks if the certain flag that specifies a characteristic of the annotation is in enabled state (see ISO-320001 12.5.3, "Annotation Flags"). This method allows only one flag to be checked at once, use constants listed insetFlag(int).- Parameters:
-
flag- an integer interpreted as set of one-bit flags. Only one bit must be set in this integer, otherwise exception is thrown. - Returns:
- true if the given flag is in enabled state.
-
getAppearanceDictionary
An appearance dictionary specifying how the annotation shall be presented visually on the page during its interactions with the user (see ISO-320001 12.5.5, "Appearance Streams"). An appearance dictionary is a dictionary containing one or several appearance streams or subdictionaries.- Returns:
-
an appearance
PdfDictionaryor null if it is not specified.
-
getAppearanceObject
Specific appearance object corresponding to the specific appearance type. This object might be either an appearance stream or an appearance subdictionary. In the latter case, the subdictionary defines multiple appearance streams corresponding to different appearance states of the annotation. See ISO-320001 12.5.5, "Appearance Streams". -
getNormalAppearanceObject
The normal appearance is used when the annotation is not interacting with the user. This appearance is also used for printing the annotation. See alsogetAppearanceObject(PdfName).- Returns:
- an appearance object which might be either an appearance stream or an appearance subdictionary.
-
getRolloverAppearanceObject
The rollover appearance is used when the user moves the cursor into the annotation’s active area without pressing the mouse button. If not specified normal appearance is used. See alsogetAppearanceObject(PdfName).- Returns:
- null if rollover appearance is not specified or an appearance object which might be either an appearance stream or an appearance subdictionary.
-
getDownAppearanceObject
The down appearance is used when the mouse button is pressed or held down within the annotation’s active area. If not specified normal appearance is used. See alsogetAppearanceObject(PdfName).- Returns:
- null if down appearance is not specified or an appearance object which might be either an appearance stream or an appearance subdictionary.
-
setAppearance
Sets a specific type of the appearance. SeegetAppearanceObject(PdfName)andgetAppearanceDictionary()for more info.- Parameters:
-
appearanceType- aPdfNamespecifying appearance type. Possible types areNormal,RolloverandDown. -
appearance- an appearance object which might be either an appearance stream or an appearance subdictionary. - Returns:
-
this
PdfAnnotationinstance.
-
setNormalAppearance
Sets normal appearance. SeegetNormalAppearanceObject()andgetAppearanceDictionary()for more info.- Parameters:
-
appearance- an appearance object which might be either an appearance stream or an appearance subdictionary. - Returns:
-
this
PdfAnnotationinstance.
-
setRolloverAppearance
Sets rollover appearance. SeegetRolloverAppearanceObject()andgetAppearanceDictionary()for more info.- Parameters:
-
appearance- an appearance object which might be either an appearance stream or an appearance subdictionary. - Returns:
-
this
PdfAnnotationinstance.
-
setDownAppearance
Sets down appearance. SeegetDownAppearanceObject()andgetAppearanceDictionary()for more info.- Parameters:
-
appearance- an appearance object which might be either an appearance stream or an appearance subdictionary. - Returns:
-
this
PdfAnnotationinstance.
-
setAppearance
Sets a specific type of the appearance usingPdfAnnotationAppearancewrapper. This method is used to set only an appearance subdictionary. SeegetAppearanceObject(PdfName)andgetAppearanceDictionary()for more info.- Parameters:
-
appearanceType- aPdfNamespecifying appearance type. Possible types areNormal,RolloverandDown. -
appearance- an appearance subdictionary wrapped inPdfAnnotationAppearance. - Returns:
-
this
PdfAnnotationinstance.
-
setNormalAppearance
Sets normal appearance usingPdfAnnotationAppearancewrapper. This method is used to set only appearance subdictionary. SeegetNormalAppearanceObject()andgetAppearanceDictionary()for more info.- Parameters:
-
appearance- an appearance subdictionary wrapped inPdfAnnotationAppearance. - Returns:
-
this
PdfAnnotationinstance.
-
setRolloverAppearance
Sets rollover appearance usingPdfAnnotationAppearancewrapper. This method is used to set only appearance subdictionary. SeegetRolloverAppearanceObject()andgetAppearanceDictionary()for more info.- Parameters:
-
appearance- an appearance subdictionary wrapped inPdfAnnotationAppearance. - Returns:
-
this
PdfAnnotationinstance.
-
setDownAppearance
Sets down appearance usingPdfAnnotationAppearancewrapper. This method is used to set only appearance subdictionary. SeegetDownAppearanceObject()andgetAppearanceDictionary()for more info.- Parameters:
-
appearance- an appearance subdictionary wrapped inPdfAnnotationAppearance. - Returns:
-
this
PdfAnnotationinstance.
-
getAppearanceState
The annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary if there is such. SeegetAppearanceObject(PdfName)for more info.- Returns:
-
a
PdfNamewhich defines selected appearance state.
-
setAppearanceState
Sets the annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary. SeegetAppearanceObject(PdfName)for more info.- Parameters:
-
as- aPdfNamewhich defines appearance state to be selected. - Returns:
-
this
PdfAnnotationinstance.
-
getBorder
An array specifying the characteristics of the annotation’s border. The array consists of three numbers defining the horizontal corner radius, vertical corner radius, and border width, all in default user space units. If the corner radii are 0, the border has square (not rounded) corners; if the border width is 0, no border is drawn.The array may have a fourth element, an optional dash array (see ISO-320001 8.4.3.6, "Line Dash Pattern").
- Returns:
-
an
PdfArrayspecifying the characteristics of the annotation’s border.
-
setBorder
Sets the characteristics of the annotation’s border.- Parameters:
-
border- anPdfAnnotationBorderspecifying the characteristics of the annotation’s border. SeegetBorder()for more detailes. - Returns:
-
this
PdfAnnotationinstance.
-
setBorder
Sets the characteristics of the annotation’s border.- Parameters:
-
border- anPdfArrayspecifying the characteristics of the annotation’s border. SeegetBorder()for more detailes. - Returns:
-
this
PdfAnnotationinstance.
-
getColorObject
An array of numbers in the range 0.0 to 1.0, representing a colour used for the following purposes:- The background of the annotation’s icon when closed
- The title bar of the annotation’s pop-up window
- The border of a link annotation
- 0 - No colour; transparent
- 1 - DeviceGray
- 3 - DeviceRGB
- 4 - DeviceCMYK
- Returns:
- An array of numbers in the range 0.0 to 1.0, representing an annotation colour.
-
setColor
Sets an annotation color. For more details on annotation color purposes and the format of the passingPdfArrayseegetColorObject().- Parameters:
-
color- an array of numbers in the range 0.0 to 1.0, specifying color. - Returns:
-
this
PdfAnnotationinstance.
-
setColor
Sets an annotation color. For more details on annotation color purposes and the format of the passing array seegetColorObject().- Parameters:
-
color- an array of numbers in the range 0.0 to 1.0, specifying color. - Returns:
-
this
PdfAnnotationinstance.
-
setColor
Sets an annotation color. For more details on annotation color purposes seegetColorObject().- Parameters:
-
color-Colorobject of the eitherDeviceGray,DeviceRgborDeviceCmyktype. - Returns:
-
this
PdfAnnotationinstance.
-
getStructParentIndex
public int getStructParentIndex()The integer key of the annotation’s entry in the structural parent tree (see ISO-320001 14.7.4.4, "Finding Structure Elements from Content Items").- Returns:
- integer key in structural parent tree or -1 if annotation is not tagged.
-
setStructParentIndex
Sets he integer key of the annotation’s entry in the structural parent tree (see ISO-320001 14.7.4.4, "Finding Structure Elements from Content Items"). Note: Normally, there is no need to take care of this manually, struct parent index is set automatically if annotation is added to the tagged document's page.- Parameters:
-
structParentIndex- integer which is to be the key of the annotation's entry in structural parent tree. - Returns:
-
this
PdfAnnotationinstance.
-
setTitle
Sets annotation title. This property affects not all annotation types.- Parameters:
-
title- aPdfStringwhich value is to be annotation title. - Returns:
-
this
PdfAnnotationinstance.
-
getTitle
Annotation title. For example for markup annotations, the title is the text label that shall be displayed in the title bar of the annotation’s pop-up window when open and active. For movie annotation Movie actions (ISO-320001 12.6.4.9, "Movie Actions") may use this title to reference the movie annotation.- Returns:
-
PdfStringwhich value is an annotation title or null if it isn't specified.
-
setRectangle
The annotation rectangle, defining the location of the annotation on the page in default user space units.- Parameters:
-
array- aPdfArraywhich specifies a rectangle by two diagonally opposite corners. Typically, the array is of form [llx lly urx ury]. - Returns:
-
this
PdfAnnotationinstance.
-
getRectangle
The annotation rectangle, defining the location of the annotation on the page in default user space units.- Returns:
-
a
PdfArraywhich specifies a rectangle by two diagonally opposite corners. Typically, the array is of form [llx lly urx ury].
-
getLang
PDF 2.0. A language identifier overriding the document’s language identifier to specify the natural language for all text in the annotation except where overridden by other explicit language specifications- Returns:
- the lang entry
-
setLang
PDF 2.0. A language identifier overriding the document’s language identifier to specify the natural language for all text in the annotation except where overridden by other explicit language specifications- Parameters:
-
lang- language identifier - Returns:
-
this
PdfAnnotationinstance
-
getBlendMode
PDF 2.0. The blend mode that shall be used when painting the annotation onto the page- Returns:
- the blend mode
-
setBlendMode
PDF 2.0. The blend mode that shall be used when painting the annotation onto the page- Parameters:
-
blendMode- blend mode - Returns:
-
this
PdfAnnotationinstance
-
getNonStrokingOpacity
public float getNonStrokingOpacity()PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for all nonstroking operations on all visible elements of the annotation in its closed state (including its background and border) but not the popup window that appears when the annotation is opened.- Returns:
- opacity value for nonstroking operations. Returns 1.0 (default value) if entry is not present
-
setNonStrokingOpacity
PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for all nonstroking operations on all visible elements of the annotation in its closed state (including its background and border) but not the popup window that appears when the annotation is opened.- Parameters:
-
nonStrokingOpacity- opacity for nonstroking operations - Returns:
-
this
PdfAnnotationinstance
-
getStrokingOpacity
public float getStrokingOpacity()PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for stroking all visible elements of the annotation in its closed state, including its background and border, but not the popup window that appears when the annotation is opened.- Returns:
- opacity for stroking operations, including background and border
-
setStrokingOpacity
PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for stroking all visible elements of the annotation in its closed state, including its background and border, but not the popup window that appears when the annotation is opened.- Parameters:
-
strokingOpacity- opacity for stroking operations, including background and border - Returns:
-
this
PdfAnnotationobject
-
put
Inserts the value into into the underlyingPdfDictionaryof thisPdfAnnotationand associates it with the specified key. If the key is already present in thisPdfAnnotation, this method will override the old value with the specified one.- Parameters:
-
key- key to insert or to override -
value- the value to associate with the specified key - Returns:
-
this
PdfAnnotationinstance.
-
remove
Removes the specified key from the underlyingPdfDictionaryof thisPdfAnnotation.- Parameters:
-
key- key to be removed - Returns:
-
this
PdfAnnotationinstance.
-
addAssociatedFile
Adds file associated with PDF annotation and identifies the relationship between them.
Associated files may be used in Pdf/A-3 and Pdf 2.0 documents. The method adds file to array value of the AF key in the annotation dictionary.
For associated files their associated file specification dictionaries shall include the AFRelationship key
- Parameters:
-
fs- file specification dictionary of associated file
-
getAssociatedFiles
Returns files associated with PDF annotation.- Parameters:
-
create- defines whether AF arrays will be created if it doesn't exist - Returns:
- associated files array
-
flush
public void flush()To manually flush aPdfObjectbehind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly callPdfObjectWrapper.makeIndirect(PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.- Overrides:
-
flushin classPdfObjectWrapper<PdfDictionary>
-
isWrappedObjectMustBeIndirect
protected boolean isWrappedObjectMustBeIndirect()Description copied from class:PdfObjectWrapperDefines if the object behind this wrapper must be an indirect object in the resultant document.
If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.
Return value of this method shouldn't depend on any logic, it should return always true or false.- Specified by:
-
isWrappedObjectMustBeIndirectin classPdfObjectWrapper<PdfDictionary> - Returns:
- true if in the resultant document the object behind the wrapper must be indirect, otherwise false.
-