Package org.jpedal.io.annotation
Class WritableAnnotation
java.lang.Object
org.jpedal.io.annotation.WritableAnnotation
- Direct Known Subclasses:
CircleAnnotation,FreeTextAnnotation,HighlightAnnotation,ImageAnnotation,InkAnnotation,LineAnnotation,LinkAnnotation,PolygonAnnotation,PolyLineAnnotation,SquareAnnotation,TextAnnotation
Interface for creating annotations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAnnotation types, each written as the matching PDF annotation/Subtype. -
Method Summary
Modifier and TypeMethodDescriptiongetAPString(int parentObj) Returns the appearance stream object to write for this annotation.Returns the form object used to create this object or null is none were used.float[]Returns the annotation's interior colour as RGB components from 0 to 1.intgetPage()Returns the page the annotation is added to.getPopupString(int parentObj) Returns the dictionary of a popup annotation to write with this annotation.byte[][]getResources(int parentObj) Returns any extra objects, such as images, that this annotation's appearance needs.float[]Returns the annotation's colour as RGB components from 0 to 1.voidsetNonStrokeColor(Color color) Sets the annotation's interior colour, written as its/ICentry by annotation types that support one.voidsetStrokeColor(Color color) Sets the annotation's colour, written as its/Centry by annotation types that support one.voidsetTextSize(int textSize) Sets the font size of the annotation's text.
-
Method Details
-
getPage
public int getPage()Returns the page the annotation is added to.- Returns:
- the page number, starting from 0
-
setTextSize
public void setTextSize(int textSize) Sets the font size of the annotation's text. Currently onlyFreeTextAnnotationuses it. Default value is 10.- Parameters:
textSize- font size in points
-
setStrokeColor
Sets the annotation's colour, written as its/Centry by annotation types that support one. The alpha of the colour is ignored. The default depends on the annotation type.- Parameters:
color- the colour to use
-
setNonStrokeColor
Sets the annotation's interior colour, written as its/ICentry by annotation types that support one. The alpha of the colour is ignored. Most annotation types default to no interior colour.- Parameters:
color- the colour to use
-
getStrokeColor
public float[] getStrokeColor()Returns the annotation's colour as RGB components from 0 to 1.- Returns:
- the colour array used by this annotation (not a copy)
-
getNonStrokeColor
public float[] getNonStrokeColor()Returns the annotation's interior colour as RGB components from 0 to 1.- Returns:
- the colour array used by this annotation (not a copy), or null if it has no interior colour
-
getFormObject
Returns the form object used to create this object or null is none were used.- Returns:
- FormObject which encapsulates all form data (accessible from getters and setters)
-
getDictString
- Returns:
- Pdf specified dictionary string
-
getPopupString
Returns the dictionary of a popup annotation to write with this annotation. This implementation logs that popups are not supported for this annotation type and returns null.- Parameters:
parentObj- object number of this annotation's dictionary- Returns:
- Pdf specified popup dictionary string, or null if there is no popup
-
getAPString
Returns the appearance stream object to write for this annotation. Subclasses that have one reference it fromgetDictString(), so this must be called first. This implementation records the object number and returns null.- Parameters:
parentObj- object number the appearance stream will be written as- Returns:
- Pdf specified appearance stream object string, or null if there is none
-
getResources
public byte[][] getResources(int parentObj) Returns any extra objects, such as images, that this annotation's appearance needs. They are written before the appearance stream, one object number each. This implementation records the object number and returns an empty array.- Parameters:
parentObj- object number the first resource will be written as- Returns:
- the resource objects to write, which may be empty
-