Class Annotation
- Direct Known Subclasses:
CircleAnnotation,FreeTextAnnotation,InkAnnotation,LineAnnotation,LinkAnnotation,PolygonAnnotation,PolyLineAnnotation,Redaction,SquareAnnotation,TextMarkupAnnotation
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotation(Page page, String subtype, Rect initialRect) Create a new Annotation at the end of a page's annotation array.Annotation(Page page, String subtype, Rect initialRect, int addAfter) Create a new Annotation at a specific index in the page's annotation array. -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()booleanGenerate a new appearance stream with the current annotation properties.doubleThe minimum PDF version necessary to support the features used in this annotation.getColor()The color of the annotation.The text to 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.getFlags()The flags for the annotation.The interior color with which to fill the annotation's line endings.doubleThe optional constant opacity value that shall be used in painting a Markup annotation.The OptionalContentMembershipDict property for this Annotation.Retrieve the PDFObject representation of this objectgetRect()The size and location of the annotation on its pageThe annotation's subtypegetTitle()The title of the annotation.booleanChecks the annotation for Rich Text String content (PDFReference 1.7 Section 8.6.2).booleanTests whether an annotation is visible in a given optional content context, considering the current ON-OFF states of the optional-content groups in the optional-content dictionary (OCMD) and the dictionary's visibility policy.voidsetAnnotationFeatureLevel(double featureLevel) Removes features not supported in the supplied version number.voidThe color of the annotation.voidsetContents(String arg0) The text to 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.voidsetFlags(EnumSet<AnnotationFlags> arg0) The flags for the annotation.voidsetInteriorColor(Color color) The interior color with which to fill the annotation's line endings.voidsetNormalAppearance(Form form) voidsetOpacity(double opacityValue) The optional constant opacity value that shall be used in painting a Markup annotation.voidThe OptionalContentMembershipDict property for this Annotation.voidThe size and location of the annotation on its pagevoidThe title of the annotation.toString()
-
Constructor Details
-
Annotation
Create a new Annotation at the end of a page's annotation array. To create an annotation and place it elsewhere in the page's annotation array, use the version of the constructor that takes an array position.- Parameters:
page- The page to which the annotation is added.subtype- The type of the annotation.initialRect- A rectangle specifying the annotation's bounds, specified in user space coordinates.
-
Annotation
Create a new Annotation at a specific index in the page's annotation array.- Parameters:
page- The page to which the annotation is added.subtype- The type of the annotation.initialRect- A rectangle specifying the annotation's bounds, specified in user space coordinates.addAfter- Where to add the annotation in the page's annotation array.
-
-
Method Details
-
delete
public void delete() -
equals
-
toString
-
getTitle
The title of the annotation. -
setTitle
The title of the annotation. -
getContents
The text to 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
The text to 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. -
getColor
The color of the annotation. -
setColor
The color of the annotation. -
getFlags
The flags for the annotation. -
setFlags
The flags for the annotation. -
getRect
The size and location of the annotation on its page -
setRect
The size and location of the annotation on its page -
getSubtype
The annotation's subtype -
isCurrentlyVisible
Tests whether an annotation is visible in a given optional content context, considering the current ON-OFF states of the optional-content groups in the optional-content dictionary (OCMD) and the dictionary's visibility policy.If the annotation occurs more than once within the content, this method only checks the visibility of the first occurrence of the annotation.
This method determines visibility without considering the visbility of the Content object that the annotation belongs to. To determine the visibility of an annotation while taking the Content's visibility into consideration, use the alternate version of this method.
- Returns:
- true if the annotation is currently visible.
-
getNormalAppearance
-
setNormalAppearance
-
generateAppearance
Generate a new appearance stream with the current annotation properties.The resulting Form can then be used to set the annotation's appearance, such as by calling SetNormalAppearance.
-
getInteriorColor
The interior color with which to fill the annotation's line endings.The color of the line itself can be retrieved from Annotation.Color.
-
setInteriorColor
The interior color with which to fill the annotation's line endings.Only RGB colors are allowed.
The color of the line itself can be retrieved from Annotation.Color.
-
getAnnotationFeatureLevel
public double getAnnotationFeatureLevel()The minimum PDF version necessary to support the features used in this annotation. -
setAnnotationFeatureLevel
public void setAnnotationFeatureLevel(double featureLevel) Removes features not supported in the supplied version number. -
getPDFDict
Retrieve the PDFObject representation of this object -
getOpacity
public double getOpacity()The optional constant opacity value that shall be used in painting a Markup annotation.Opacity is a range from 0.0 (fully transparent) to 1.0 (fully opaque).
-
setOpacity
public void setOpacity(double opacityValue) The optional constant opacity value that shall be used in painting a Markup annotation.Opacity is a range from 0.0 (fully transparent) to 1.0 (fully opaque).
-
getOptionalContentMembershipDict
The OptionalContentMembershipDict property for this Annotation.Setting this property will attach the Annotation to an OptionalContentMembershipDict; it will then be associated with the OptionalContentGroups and be subject to the VisibilityPolicy and VisibilityExpression of that MembershipDict.
By setting this property to null, the Annotation is detached from any OptionalContentMembershipDict.
- Returns:
- the OptionalContentMembershipDict
-
setOptionalContentMembershipDict
The OptionalContentMembershipDict property for this Annotation.Setting this property will attach the Annotation to an OptionalContentMembershipDict; it will then be associated with the OptionalContentGroups and be subject to the VisibilityPolicy and VisibilityExpression of that MembershipDict.
By setting this property to null, the Annotation is detached from any OptionalContentMembershipDict.
- Parameters:
ocmd- the OptionalContentMembershipDict
-
hasRichTextData
public boolean hasRichTextData()Checks the annotation for Rich Text String content (PDFReference 1.7 Section 8.6.2). Annotations that contain Rich Text String content and do not have a normal appearance set will not be visible when rendering the page.
-