|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.core.pobjects.Dictionary
org.icepdf.core.pobjects.annotations.Annotation
public class Annotation
An Annotation class associates an object such as a note, sound, or movie with
a location on a page of a PDF document, or provides a way to interact with
the user by means of the mouse and keyboard.
This class allows direct access to the a Annotations dictionary. Developers can take advantage of this information as they see fit. It is important to note that an annotations' rectangle coordinates are defined in the PDF document space. In order to map the rectangle coordinates to a view, they must be converted from the Cartesian plain to the the Java2D plain. The PageView method getPageBounds() can be used to locate the position of a page within its parent component.
Base class of all the specific Annotation types Taken from the PDF 1.6 spec, here is some relevant documentation, along with some additional commentary| Key | Type | Value | |
| Type | name | (Optional) The type of PDF object that this dictionary describes; if present, must be Annot for an annotation dictionary. | |
| Subtype | name | (Required) The type of annotation that this dictionary describes. | |
| Rect | rectangle | (Required) The annotation rectangle, defining the location of the annotation on the page in default user space units. | getUserspaceLocation() |
| Contents | text string | (Optional) 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.'s contents in support of accessibility to users with disabilities or for other purposes (see Section 10.8.2, "Alternate Descriptions"). See Section 8.4.5, "Annotation Types" for more details on the meaning of this entry for each annotation type. | |
| P | dictionary | (Optional; PDF 1.3; not used in FDF files) An indirect reference to the page object with which this annotation is associated. | |
| NM | text string | (Optional; PDF 1.4) The annotation name, a text string uniquely identifying it among all the annotations on its page. | |
| M | date or string | (Optional; PDF 1.1) The date and time when the annotation was most recently modified. The preferred format is a date string as described in Section 3.8.3, "Dates," but viewer applications should be prepared to accept and display a string in any format. (See implementation note 78 in Appendix H.) | |
| F | integer | (Optional; PDF 1.1) A set of flags specifying various characteristics of the annotation (see Section 8.4.2, "Annotation Flags"). Default value: 0. | |
| BS | dictionary | (Optional; PDF 1.2) A border style dictionary specifying the characteristics of
the annotation's border (see Section 8.4.3, "Border Styles"; see also implementation
notes 79 and 86 in Appendix H). Note: This entry also specifies the width and dash pattern for the lines drawn by line, square, circle, and ink annotations. See the note under Border (below) for additional information. Table 8.13 summarizes the contents of the border style dictionary. If neither the Border nor the BS entry is present, the border is drawn as a solid line with a width of 1 point. |
|
| AP | dictionary | (Optional; PDF 1.2) An appearance dictionary specifying how the annotation
is presented visually on the page (see Section 8.4.4, "Appearance Streams" and
also implementation notes 79 and 80 in Appendix H). Individual annotation
handlers may ignore this entry and provide their own appearances. For convenience in managing appearance streams that are used repeatedly, the AP entry in a PDF document's name dictionary (see Section 3.6.3, "Name Dictionary") can contain a name tree mapping name strings to appearance streams. The name strings have no standard meanings; no PDF objects refer to appearance streams by name. |
|
| AS | name | (Required if the appearance dictionary AP contains one or more subdictionaries; PDF 1.2) The annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary (see Section 8.4.4, "Appearance Streams" and also implementation note 79 in Appendix H). | |
| Border | array | (Optional) An array specifying the characteristics of the annotation's border.
The border is specified as a rounded rectangle. In PDF 1.0, 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. (See implementation note 81 in Appendix H.) In PDF 1.1, the array may have a fourth element, an optional dash array defining a pattern of dashes and gaps to be used in drawing the border. The dash array is specified in the same format as in the line dash pattern parameter of the graphics state (see "Line Dash Pattern" on page 187). For example, a Border value of [0 0 1 [3 2]] specifies a border 1 unit wide, with square corners, drawn with 3-unit dashes alternating with 2-unit gaps. Note that no dash phase is specified; the phase is assumed to be 0. (See implementation note 82 in Appendix H.) Note: In PDF 1.2 or later, this entry may be ignored in favor of the BS entry (see above); see implementation note 86 in Appendix H. Default value: [0 0 1]. |
|
| BE | dictionary | (Optional; PDF 1.5) Some annotations (square, circle, and polygon) may have a BE entry, which is a border effect dictionary that specifies an effect to be applied to the border of the annotations. Its entries are listed in Table 8.14. | |
| C | array | (Optional; PDF 1.1) An array of three numbers in the range 0.0 to 1.0, representing
the components of a color in the DeviceRGB color space. This color is
used for the following purposes:
|
|
| A | dictionary | (Optional; PDF 1.1) An action to be performed when the annotation is activated
(see Section 8.5, "Actions"). Note: This entry is not permitted in link annotations if a Dest entry is present (see "Link Annotations" on page 587). Also note that the A entry in movie annotations has a different meaning (see "Movie Annotations" on page 601). |
|
| AA | dictionary | (Optional; PDF 1.2) An additional-actions dictionary defining the annotation's behavior in response to various trigger events (see Section 8.5.2, "Trigger Events"). At the time of publication, this entry is used only by widget annotations. | |
| StructParent | integer | ((Required if the annotation is a structural content item; PDF 1.3) The integer key of the annotation's entry in the structural parent tree (see "Finding Structure Elements from Content Items" on page 797). | |
| OC | dictionary | (Optional; PDF 1.5) An optional content group or optional content membership dictionary (see Section 4.10, "Optional Content") specifying the optional content properties for the annotation. Before the annotation is drawn, its visibility is determined based on this entry as well as the annotation flags specified in the F entry (see Section 8.4.2, "Annotation Flags"). If it is determined to be invisible, the annotation is skipped, as if it were not in the document. |
| Bit position | Name | Meaning |
| 1 | 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 an unknown annotation using an appearance stream specified by its appearance dictionary, if any (see Section 8.4.4, "Appearance Streams"). |
| 2 | 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. In cases where screen space is limited, the ability to hide and show annotations selectively can be used in combination with appearance streams (see Section 8.4.4, "Appearance Streams") to display auxiliary pop-up information similar in function to online help systems. (See implementation note 83 in Appendix H.) |
| 3 | 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. This can be useful, for example, for annotations representing interactive pushbuttons, which would serve no meaningful purpose on the printed page. (See implementation note 83 in Appendix H.) | |
| 4 | NoZoom | 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) remains fixed, regardless of the page magnification. See below for further discussion. |
| 5 | NoRotate | If set, do not rotate the annotation's appearance to match the rotation of the page. The upper-left corner of the annotation rectangle remains in a fixed location on the page, regardless of the page rotation. See below for further discussion. |
| 6 | NoView | 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. |
| 7 | ReadOnly | 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. Note: This flag is ignored for widget annotations; its function is subsumed by the ReadOnly flag of the associated form field (see Table 8.66 on page 638). |
| 8 | 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. (See implementation note 84 in Appendix H.) |
| 9 | ToggleNoView | If set, invert the interpretation of the NoView flag for certain events. A typical use is to have an annotation that appears only when a mouse cursor is held over it; see implementation note 85 in Appendix H. |
| Field Summary | |
|---|---|
static Name |
ACTION_KEY
The action to be performed whenteh annotation is activated. |
static Name |
APPEARANCE_STATE_KEY
Appearance state selecting default from multiple AP's. |
static Name |
APPEARANCE_STREAM_DOWN_KEY
Appearance dictionary specifying how the annotation is presented visually on the page for down display. |
static Name |
APPEARANCE_STREAM_KEY
Appearance dictionary specifying how the annotation is presented visually on the page. |
static Name |
APPEARANCE_STREAM_NORMAL_KEY
Appearance dictionary specifying how the annotation is presented visually on the page for normal display. |
static Name |
APPEARANCE_STREAM_ROLLOVER_KEY
Appearance dictionary specifying how the annotation is presented visually on the page for rollover display. |
protected java.util.Vector<java.lang.Number> |
border
|
static int |
BORDER_DASH
|
static int |
BORDER_HORIZONTAL_CORNER_RADIUS
Border property indexes for the border vector, only applicable if the border style has not been set. |
static Name |
BORDER_KEY
Annotation border characteristics. |
static Name |
BORDER_STYLE_KEY
Border style |
static int |
BORDER_VERTICAL_CORNER_RADIUS
|
static int |
BORDER_WIDTH
|
protected BorderStyle |
borderStyle
|
protected boolean |
canDrawBorder
|
protected java.awt.Color |
color
|
static Name |
COLOR_KEY
RGB colour value for background, titlebars and link annotation borders |
static Name |
FLAG_KEY
Annotation border characteristics. |
static int |
INVISIBLE_RECTANGLE
|
static Name |
PARENT_PAGE_KEY
Page that this annotation is associated with. |
static Name |
RECTANGLE_KEY
The annotation location on the page in user space units. |
protected Name |
subtype
|
static Name |
SUBTYPE_CIRCLE
|
static Name |
SUBTYPE_HIGHLIGHT
|
static Name |
SUBTYPE_LINE
|
static Name |
SUBTYPE_LINK
Annotation subtype and types. |
static Name |
SUBTYPE_POLYGON
|
static Name |
SUBTYPE_POLYLINE
|
static Name |
SUBTYPE_SQUARE
|
static Name |
TYPE_VALUE
Dictionary constants for Annotations. |
protected java.awt.geom.Rectangle2D.Float |
userSpaceRectangle
|
static int |
VISIBLE_RECTANGLE
Annotion may or may not have a visible rectangle border |
| Fields inherited from class org.icepdf.core.pobjects.Dictionary |
|---|
entries, inited, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY |
| Constructor Summary | |
|---|---|
Annotation(Library l,
java.util.Hashtable h)
Creates a new instance of an Annotation. |
|
| Method Summary | |
|---|---|
Action |
addAction(Action action)
Adds the specified action to this annotation isnstance. |
boolean |
allowAlterProperties()
|
boolean |
allowPrintNormalMode()
|
boolean |
allowScreenDownMode()
|
boolean |
allowScreenNormalMode()
|
protected boolean |
allowScreenOrPrintRenderingOrInteraction()
|
boolean |
allowScreenRolloverMode()
|
static Annotation |
buildAnnotation(Library library,
java.util.Hashtable hashTable)
Should only be called from Parser, Use AnnotationFactory if you creating a new annotation. |
boolean |
deleteAction(Action action)
Deletes the annotation action specified as a paramater. |
Action |
getAction()
Gets the action to be performed when the annotation is activated. |
java.util.Vector<java.lang.Number> |
getBorder()
|
BorderStyle |
getBorderStyle()
|
java.awt.Color |
getColor()
Gest the RGB colour of the annotation used for the following purposes: the background of the annotaiton's icon when closed the title bar of the anntoation's pop-up window the border of a link annotation |
boolean |
getFlagHidden()
|
boolean |
getFlagInvisible()
|
boolean |
getFlagLocked()
A locked annotation can not be deleted or its properties such as position and size to be modified by the user. |
boolean |
getFlagNoRotate()
|
boolean |
getFlagNoView()
|
boolean |
getFlagNoZoom()
|
boolean |
getFlagPrint()
|
boolean |
getFlagReadOnly()
|
boolean |
getFlagToggleNoView()
|
java.lang.String |
getLineStyle()
Gets the Annotation border style for the given annotation. |
float |
getLineThickness()
Gets the line thickness assoicated with this annotation. |
int |
getLinkType()
Gets the Link type, can be either VISIBLE_RECTANGLE or INVISIBLE_RECTANGLE, it all depends on the if the border or BS has border width > 0. |
Page |
getPage()
|
Annotation |
getParentAnnotation()
|
java.lang.String |
getSubType()
Gets the type of annotation that this dictionary describes. |
java.awt.geom.Rectangle2D.Float |
getUserSpaceRectangle()
Gets the annotation rectangle, and defines the location of the annotation on the page in default user space units. |
boolean |
isBorder()
Checks to see if the annotation has defined a drawable border width. |
protected boolean |
isSupportedAnnotationType()
The PDF spec defines rules for displaying annotation subtypes that the viewer does not recognise. |
void |
render(java.awt.Graphics2D origG,
int renderHintType,
float totalRotation,
float userZoom,
boolean tabSelected)
|
protected void |
renderAppearanceStream(java.awt.Graphics2D g)
|
protected void |
renderBorder(java.awt.Graphics2D g)
|
protected void |
renderBorderTabSelected(java.awt.Graphics2D g)
|
void |
setBorderStyle(BorderStyle borderStyle)
|
void |
setColor(java.awt.Color color)
Sets the Annotation colour and underlying |
void |
setUserSpaceRectangle(java.awt.geom.Rectangle2D.Float rect)
Sets the users page rectangle for this annotation action instance |
java.lang.String |
toString()
Returns a summary of the dictionary entries. |
boolean |
updateAction(Action action)
Update the current annotation action with this entry. |
| Methods inherited from class org.icepdf.core.pobjects.Dictionary |
|---|
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getObject, getPObjectReference, init, isDeleted, isNew, setDeleted, setNew, setPObjectReference |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Name TYPE_VALUE
public static final Name SUBTYPE_LINK
public static final Name SUBTYPE_LINE
public static final Name SUBTYPE_SQUARE
public static final Name SUBTYPE_CIRCLE
public static final Name SUBTYPE_POLYGON
public static final Name SUBTYPE_POLYLINE
public static final Name SUBTYPE_HIGHLIGHT
public static final Name BORDER_STYLE_KEY
public static final Name RECTANGLE_KEY
public static final Name ACTION_KEY
public static final Name PARENT_PAGE_KEY
public static final Name BORDER_KEY
public static final Name FLAG_KEY
public static final Name COLOR_KEY
public static final Name APPEARANCE_STREAM_KEY
public static final Name APPEARANCE_STATE_KEY
public static final Name APPEARANCE_STREAM_NORMAL_KEY
public static final Name APPEARANCE_STREAM_ROLLOVER_KEY
public static final Name APPEARANCE_STREAM_DOWN_KEY
public static final int BORDER_HORIZONTAL_CORNER_RADIUS
public static final int BORDER_VERTICAL_CORNER_RADIUS
public static final int BORDER_WIDTH
public static final int BORDER_DASH
public static final int VISIBLE_RECTANGLE
public static final int INVISIBLE_RECTANGLE
protected Name subtype
protected BorderStyle borderStyle
protected java.util.Vector<java.lang.Number> border
protected java.awt.Color color
protected java.awt.geom.Rectangle2D.Float userSpaceRectangle
protected boolean canDrawBorder
| Constructor Detail |
|---|
public Annotation(Library l,
java.util.Hashtable h)
l - document library.h - dictionary entries.| Method Detail |
|---|
public static Annotation buildAnnotation(Library library,
java.util.Hashtable hashTable)
library - document libraryhashTable - annotation properties.
public java.lang.String getSubType()
public java.awt.geom.Rectangle2D.Float getUserSpaceRectangle()
public void setUserSpaceRectangle(java.awt.geom.Rectangle2D.Float rect)
public Action getAction()
public Action addAction(Action action)
action - action to add to this annotation. This action must
be created using the the ActionFactory in order to correctly setup
the Pobject reference.
public boolean deleteAction(Action action)
action - action to remove
public boolean updateAction(Action action)
action - action to update
public boolean allowScreenNormalMode()
public boolean allowScreenRolloverMode()
public boolean allowScreenDownMode()
public boolean allowPrintNormalMode()
public boolean allowAlterProperties()
public void setBorderStyle(BorderStyle borderStyle)
public BorderStyle getBorderStyle()
public java.util.Vector<java.lang.Number> getBorder()
public Annotation getParentAnnotation()
public Page getPage()
public int getLinkType()
public java.lang.String getLineStyle()
public float getLineThickness()
public boolean isBorder()
public void render(java.awt.Graphics2D origG,
int renderHintType,
float totalRotation,
float userZoom,
boolean tabSelected)
protected void renderAppearanceStream(java.awt.Graphics2D g)
protected void renderBorder(java.awt.Graphics2D g)
protected void renderBorderTabSelected(java.awt.Graphics2D g)
public java.awt.Color getColor()
public void setColor(java.awt.Color color)
color - protected boolean allowScreenOrPrintRenderingOrInteraction()
protected boolean isSupportedAnnotationType()
public boolean getFlagInvisible()
public boolean getFlagHidden()
public boolean getFlagPrint()
public boolean getFlagNoZoom()
public boolean getFlagNoRotate()
public boolean getFlagNoView()
public boolean getFlagReadOnly()
public boolean getFlagLocked()
public boolean getFlagToggleNoView()
public java.lang.String toString()
Dictionary
toString in class Dictionary
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||