java.lang.Object | |
↳ | com.pdftron.pdf.Annot |
Known Direct Subclasses |
Known Indirect Subclasses |
Annot is a base class for different types of annotations. For annotation specific properties, please refer to derived classes. An annotation is an interactive object placed on a page, such as a text note, a link, or an embedded file. PDF includes a wide variety of standard annotation types. An annotation associates an object such as a widget, note, or movie with a location on a page of a PDF document, or provides a means of interacting with the user via the mouse and keyboard. For more details on PDF annotations please refer to section 12.5 in the PDF Reference Manual and the
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | Annot.BorderStyle | BorderStyle structure specifies the characteristics of the annotation's border. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | e_3D | The Constant e_3D. | |||||||||
int | e_Caret | The Constant e_Caret. | |||||||||
int | e_Circle | The Constant e_Circle. | |||||||||
int | e_FileAttachment | The Constant e_FileAttachment. | |||||||||
int | e_FreeText | The Constant e_FreeText. | |||||||||
int | e_Highlight | The Constant e_Highlight. | |||||||||
int | e_Ink | The Constant e_Ink. | |||||||||
int | e_Line | The Constant e_Line. | |||||||||
int | e_Link | The Constant e_Link. | |||||||||
int | e_Movie | The Constant e_Movie. | |||||||||
int | e_Polygon | The Constant e_Polygon. | |||||||||
int | e_Polyline | The Constant e_Polyline. | |||||||||
int | e_Popup | The Constant e_Popup. | |||||||||
int | e_PrinterMark | The Constant e_PrinterMark. | |||||||||
int | e_Projection | The Constant e_Projection. | |||||||||
int | e_Redact | The Constant e_Redact. | |||||||||
int | e_RichMedia | The Constant e_RichMedia. | |||||||||
int | e_Screen | The Constant e_Screen. | |||||||||
int | e_Sound | The Constant e_Sound. | |||||||||
int | e_Square | The Constant e_Square. | |||||||||
int | e_Squiggly | The Constant e_Squiggly. | |||||||||
int | e_Stamp | The Constant e_Stamp. | |||||||||
int | e_StrikeOut | The Constant e_StrikeOut. | |||||||||
int | e_Text | PDF supports the standard annotation types listed in the following enumeration (plug-in extensions may add new annotation types):. | |||||||||
int | e_TrapNet | The Constant e_TrapNet. | |||||||||
int | e_Underline | The Constant e_Underline. | |||||||||
int | e_Unknown | The Constant e_Unknown. | |||||||||
int | e_Watermark | The Constant e_Watermark. | |||||||||
int | e_Widget | The Constant e_Widget. | |||||||||
int | e_action_trigger_activate | Triggered when the annotation is activated. | |||||||||
int | e_action_trigger_annot_blur | Triggered when the annotation loses the input focus | |||||||||
int | e_action_trigger_annot_down | Triggered when the mouse button is pressed inside the annotation's active area | |||||||||
int | e_action_trigger_annot_enter | Triggered when the cursor enters the annotation's active area | |||||||||
int | e_action_trigger_annot_exit | Triggered when the cursor exits the annotation's active area | |||||||||
int | e_action_trigger_annot_focus | Triggered when the annotation receives the input focus | |||||||||
int | e_action_trigger_annot_page_close | Triggered when the page containing the annotation is closed | |||||||||
int | e_action_trigger_annot_page_invisible | Triggered when the page containing the annotation is no longer visible in the interactive PDF processor's user interface | |||||||||
int | e_action_trigger_annot_page_open | Triggered when the page containing the annotation is opened | |||||||||
int | e_action_trigger_annot_page_visible | Triggered when the page containing the annotation becomes visible | |||||||||
int | e_action_trigger_annot_up | Triggered when the mouse button is released inside the annotation's active area | |||||||||
int | e_down | The Constant e_down. | |||||||||
int | e_hidden | The Constant e_hidden. | |||||||||
int | e_invisible | Flags specifying various characteristics of the annotation. | |||||||||
int | e_locked | The Constant e_locked. | |||||||||
int | e_locked_contents | The Constant e_locked_contents. | |||||||||
int | e_no_rotate | The Constant e_no_rotate. | |||||||||
int | e_no_view | The Constant e_no_view. | |||||||||
int | e_no_zoom | The Constant e_no_zoom. | |||||||||
int | e_normal | An annotation can define as many as three separate appearances: The normal appearance is used when the annotation is not interacting with the user. | |||||||||
int | e_print | The Constant e_print. | |||||||||
int | e_read_only | The Constant e_read_only. | |||||||||
int | e_rollover | The Constant e_rollover. | |||||||||
int | e_toggle_no_view | The Constant e_toggle_no_view. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Annot(Obj d)
Create an annotation and initialize it using given Cos/SDF object.
| |||||||||||
Annot()
Create an empty annotation.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int |
GetStructParent()
Get the struct parent of an annotation.
| ||||||||||
static Annot | __Create(long impl, Object ref) | ||||||||||
long | __GetHandle() | ||||||||||
Object | __GetRefHandle() | ||||||||||
static Annot |
create(Doc doc, int type, Rect pos)
Creates a new annotation of a given type, in the specified document.
| ||||||||||
void |
deleteCustomData(String key)
Deletes custom data associated with the given key.
| ||||||||||
boolean |
equals(Object d)
Compares two annotations for equality.
| ||||||||||
void |
flatten(Page page)
Flatten/Merge the existing annotation appearances with the page content and
delete this annotation from a given page.
| ||||||||||
String |
getActiveAppearanceState()
Get the annotation's active appearance state.
| ||||||||||
Obj |
getAppearance(int annot_state, String app_state)
Get the annotation's appearance for the given combination of annotation
and appearance states.
| ||||||||||
Obj |
getAppearance()
Get the annotation's appearance for the given combination of annotation
and appearance states.
| ||||||||||
Obj |
getAppearance(int annot_state)
Get the annotation's appearance for the given combination of annotation
and appearance states.
| ||||||||||
Annot.BorderStyle |
getBorderStyle()
Get the border style for the annotation.
| ||||||||||
ColorPt |
getColorAsCMYK()
Get an annotation's color.
| ||||||||||
ColorPt |
getColorAsGray()
Get an annotation's color.
| ||||||||||
ColorPt |
getColorAsRGB()
Get an annotation's color.
| ||||||||||
int |
getColorCompNum()
Get the color space the annotation's color is represented in.
| ||||||||||
String |
getContents()
Get the annotation contents.
| ||||||||||
String |
getCustomData(String key)
Returns custom data associated with the given key.
| ||||||||||
Date |
getDate()
Gets an annotation's last modified date.
| ||||||||||
boolean |
getFlag(int flag)
Determine if the give flag is marked flagged
| ||||||||||
Obj |
getOptionalContent()
Get optional content of an annotation.
| ||||||||||
Page |
getPage()
Get the page the annotation is associated with.
| ||||||||||
Rect |
getRect()
Get annoation bound rectangle
| ||||||||||
int |
getRotation()
Get the rotation value of the annotation.
| ||||||||||
Obj |
getSDFObj()
Get the SDFObj.
| ||||||||||
Obj |
getTriggerAction(int trigger)
Get the Action associated with the selected Annot Trigger event.
| ||||||||||
int |
getType()
Get the annotation type.
| ||||||||||
Obj |
getUniqueID()
Get the annotiation unique ID.
| ||||||||||
Rect |
getVisibleContentBox()
It is possible during viewing that GetRect does not return the most accurate bounding box
of what is actually rendered.
| ||||||||||
int | hashCode() | ||||||||||
boolean |
isMarkup()
Checks if annoation is markup.
| ||||||||||
boolean |
isValid()
Checks if Annot is valid.
| ||||||||||
void |
refreshAppearance()
Regenerates the appearance stream for the annotation.
| ||||||||||
void |
refreshAppearance(RefreshOptions opts)
A version of RefreshAppearance allowing custom options to make slight tweaks in behaviour.
| ||||||||||
void |
removeAppearance()
Removes the annotation's default appearance.
| ||||||||||
void |
removeAppearance(int annot_state, String app_state)
Removes the annotation's appearance for the given combination of annotation
and appearance states.
| ||||||||||
void |
resize(Rect pos)
Resize annotation
| ||||||||||
void |
setActiveAppearanceState(String astate)
Set the annotation's active appearance state.
| ||||||||||
void |
setAppearance(Obj app_stream, int annot_state)
Set the annotation's appearance for the given combination of annotation
and appearance states.
| ||||||||||
void |
setAppearance(Obj app_stream)
Set the annotation's appearance for the given combination of annotation
and appearance states.
| ||||||||||
void |
setAppearance(Obj app_stream, int annot_state, String app_state)
Set the annotation's appearance for the given combination of annotation
and appearance states.
| ||||||||||
void |
setBorderStyle(Annot.BorderStyle bs)
Set the border style for the annotation.
| ||||||||||
void |
setColor(ColorPt cpt)
Set an annotation's color.
| ||||||||||
void |
setColor(ColorPt cpt, int comp_num)
Set an annotation's color.
| ||||||||||
void |
setContents(String ct)
Set annotation contents.
| ||||||||||
void |
setCustomData(String key, String value)
Sets the custom data associated with the specified key.
| ||||||||||
void |
setDate(Date date)
Sets an annotation's last modified date.
| ||||||||||
void |
setDateToNow()
Sets an annotation's last modified date to the current time.
| ||||||||||
void |
setFlag(int flag, boolean value)
Set the value of given Flag.
| ||||||||||
void |
setOptionalContent(Obj oc)
Set optional content of an annotation.
| ||||||||||
void |
setPage(Page page)
Set the reference to a page the annotation is associated with.
| ||||||||||
void |
setRect(Rect pos)
Set the size and location of an annotation on its page.
| ||||||||||
void |
setRotation(int rot)
Set the rotation value of the annotation.
| ||||||||||
void |
setStructParent(int keyval)
Set the struct parent of an annotation.
| ||||||||||
void |
setUniqueID(String icon_name)
Set the unique identifier for this annotation.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The Constant e_3D.
The Constant e_Caret.
The Constant e_Circle.
The Constant e_FileAttachment.
The Constant e_FreeText.
The Constant e_Highlight.
The Constant e_Ink.
The Constant e_Line.
The Constant e_Link.
The Constant e_Movie.
The Constant e_Polygon.
The Constant e_Polyline.
The Constant e_Popup.
The Constant e_PrinterMark.
The Constant e_Projection.
The Constant e_Redact.
The Constant e_RichMedia.
The Constant e_Screen.
The Constant e_Sound.
The Constant e_Square.
The Constant e_Squiggly.
The Constant e_Stamp.
The Constant e_StrikeOut.
PDF supports the standard annotation types listed in the following enumeration (plug-in extensions may add new annotation types):.
The Constant e_TrapNet.
The Constant e_Underline.
The Constant e_Unknown.
The Constant e_Watermark.
The Constant e_Widget.
Triggered when the annotation is activated. if present, takes precedence over U entry (e_action_trigger_annot_up)
Triggered when the annotation loses the input focus
Triggered when the mouse button is pressed inside the annotation's active area
Triggered when the cursor enters the annotation's active area
Triggered when the cursor exits the annotation's active area
Triggered when the annotation receives the input focus
Triggered when the page containing the annotation is closed
Triggered when the page containing the annotation is no longer visible in the interactive PDF processor's user interface
Triggered when the page containing the annotation is opened
Triggered when the page containing the annotation becomes visible
Triggered when the mouse button is released inside the annotation's active area
The Constant e_down.
The Constant e_hidden.
Flags specifying various characteristics of the annotation. - If e_invisible is 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. - If e_hidden is 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. - If e_print is 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. - If e_no_zoom is set, do not scale the annotation's appearance to match the magnification of the page. - If e_no_rotate is set, do not rotate the annotation's appearance to match the rotation of the page. - If e_no_view is 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. - If e_read_only is 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. - If e_locked is 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. - If e_toggle_no_view is 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. - If e_locked_contents is 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.
The Constant e_locked.
The Constant e_locked_contents.
The Constant e_no_rotate.
The Constant e_no_view.
The Constant e_no_zoom.
An annotation can define as many as three separate appearances: The normal appearance is used when the annotation is not interacting with the user. This appearance is also used for printing the annotation. The rollover appearance is used when the user moves the cursor into the annotation's active area without pressing the mouse button. The down appearance is used when the mouse button is pressed or held down within the annotation's active area.
The Constant e_print.
The Constant e_read_only.
The Constant e_rollover.
The Constant e_toggle_no_view.
Create an annotation and initialize it using given Cos/SDF object.
Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.
d | the d |
---|
Create an empty annotation.
Get the struct parent of an annotation. (Required if the annotation is a structural content item; PDF'1.3)
Note: The StructParent is the integer key of the annotation's entry in the structural parent tree.
PDFNetException |
---|
Creates a new annotation of a given type, in the specified document. Because the newly created annotation does not contain any properties specific to a given annotation type, it is faster to create an annotation using type specific Annot.Create method.
doc | A document to which the annotation is added. |
---|---|
type | Subtype of annotation to create. |
pos | A rectangle specifying the annotation's bounds, specified in user space coordinates. |
PDFNetException |
---|
Deletes custom data associated with the given key.
key | The key for which to delete the associated data. |
---|
PDFNetException |
---|
Compares two annotations for equality. The comparison will return true only if both annotations share the same underlying SDF/Cos object.
d | the other annotation |
---|
Flatten/Merge the existing annotation appearances with the page content and delete this annotation from a given page. Annotation 'flattening' refers to the operation that changes active annotations (such as markup, widgets, 3D models, etc.) into a static area that is part of the PDF document, just like the other text and images in the document.
Note: an alternative approach to set the annotation as read only is using Annot.SetFlag(Annot::e_read_only, true) method. Unlike Annot.SetFlag(...), the result of Flatten() operation can not be programatically reversed.
page | the page |
---|
PDFNetException |
---|
Get the annotation's active appearance state.
PDFNetException |
---|
Get the annotation's appearance for the given combination of annotation and appearance states.
annot_state | The annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. |
---|---|
app_state | Is an optional parameter specifying the appearance state to look for (e.g. "Off", "On", etc). If appearance_state is NULL, the choice between different appearance states is determined by the AS (Appearance State) entry in the annotation dictionary. |
PDFNetException |
---|
Get the annotation's appearance for the given combination of annotation and appearance states.
PDFNetException |
---|
Get the annotation's appearance for the given combination of annotation and appearance states.
annot_state | The annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. |
---|
PDFNetException |
---|
Get the border style for the annotation. Typically used for Link annotations.
PDFNetException |
---|
Get an annotation's color.
PDFNetException |
---|
Get an annotation's color.
PDFNetException |
---|
Get an annotation's color.
PDFNetException |
---|
Get the color space the annotation's color is represented in.
PDFNetException |
---|
Returns custom data associated with the given key.
key | The key for which to retrieve the associated data. |
---|
PDFNetException |
---|
Gets an annotation's last modified date.
PDFNetException |
---|
Determine if the give flag is marked flagged
flag | The Flag property to query. |
---|
PDFNetException |
---|
Get optional content of an annotation.
Note: The return value is an (optional content) group or (optional content) membership dictionary (PDF::OCG::OCMD)specifying the optional content properties for the annotation. Before the annotation is drawn, its visibility shall be determined based on this entry as well as the annotation flags specified in the Flag entry . If it is determined to be invisible, the annotation shall be skipped, as if it were not in the document.
PDFNetException |
---|
Get the page the annotation is associated with.
PDFNetException |
---|
Get annoation bound rectangle
PDFNetException |
---|
Get the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90.
Note: This property is part of the appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.
PDFNetException |
---|
Get the Action associated with the selected Annot Trigger event.
trigger | the type of trigger event to get |
---|
PDFNetException |
---|
Get the annotiation unique ID.
PDFNetException |
---|
It is possible during viewing that GetRect does not return the most accurate bounding box of what is actually rendered. This method calculates the bounding box, rather than relying on what is specified in the PDF document. The bounding box is defined as the smallest rectangle that includes all the visible content on the annotation.
PDFNetException |
---|
Checks if Annot is valid.
PDFNetException |
---|
Regenerates the appearance stream for the annotation. This method can be used to auto-generate the annotation appearance after creating or modifying the annotation without providing an explicit appearance or setting the "NeedAppearances" flag in the AcroForm dictionary.
Note: If this annotation contains text, and has been added to a rotated page, the text in the annotation may be rotated. If RefreshAppearance is called *after* the annotation is added to a rotated page, then any text will be rotated in the opposite direction of the page rotation. If this method is called *before* the annotation is added to any rotated page, then no counter rotation will be applied. If you wish to call RefreshAppearance on an annotation already added to a rotated page, but you don't want the text to be rotated, you can do one of the following; temporarily un-rotate the page, or, temporarily remove the "Rotate" object from the annotation. To support users adding text annotations while using a PDF viewer, you can also add any viewer rotation to the annotations Rotate object, to have text always rotated correctly, from the users perspective.
PDFNetException |
---|
A version of RefreshAppearance allowing custom options to make slight tweaks in behaviour.
PDFNetException |
---|
Removes the annotation's appearance for the given combination of annotation and appearance states.
annot_state | the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. |
---|---|
app_state | is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotaion state. |
PDFNetException |
---|
Set the annotation's active appearance state. (Required if the appearance dictionary AP contains one or more subdictionaries; PDF'1.2)
astate | a string representing the name of the new active appearance state. The string used to select the annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary. |
---|
PDFNetException |
---|
Set the annotation's appearance for the given combination of annotation and appearance states. (Optional; PDF'1.2)
app_stream | a content stream defining the new appearance. |
---|---|
annot_state | the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. |
PDFNetException |
---|
Set the annotation's appearance for the given combination of annotation and appearance states. (Optional; PDF'1.2)
app_stream | a content stream defining the new appearance. |
---|
PDFNetException |
---|
Set the annotation's appearance for the given combination of annotation and appearance states. (Optional; PDF'1.2)
app_stream | a content stream defining the new appearance. |
---|---|
annot_state | the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. |
app_state | is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotaion state. |
PDFNetException |
---|
Set the border style for the annotation. Typically used for Link annotations.
bs | New border style for this annotation. |
---|
PDFNetException |
---|
Set an annotation's color.
cpt | a ColorPt containing color components in RGB ColorSpace |
---|
PDFNetException |
---|
Set an annotation's color.
cpt | a ColorPt containing color components based on the associated ColorSpace |
---|---|
comp_num | The color component number that indirectly implies the color space the color is from. |
PDFNetException |
---|
Sets the custom data associated with the specified key.
key | The key under which to store this custom data. |
---|---|
value | The custom data string to store. |
PDFNetException |
---|
Sets an annotation's last modified date.
date | The annotation's last modified time and date. Corresponds to the "M" entry of the annotation dictionary. |
---|
PDFNetException |
---|
Sets an annotation's last modified date to the current time.
PDFNetException |
---|
Set the value of given Flag.
flag | The Flag property to modify. |
---|---|
value | The new value for the property. |
PDFNetException |
---|
Set optional content of an annotation. (Optional, PDF1.5).
oc | An SDF object corresponding to the optional content, a PDF::OCG::Group or membership dictionary specifying the PDF::OCG::Group properties for the annotation. Before the annotation is drawn, its visibility shall be determined based on this entry as well as the annotation flags specified in the Flag entry . If it is determined to be invisible, the annotation shall be skipped, as if it were not in the document. |
---|
PDFNetException |
---|
Set the reference to a page the annotation is associated with. (Optional PDF'1.3; not used in FDF files)
Note: The parameter should be an indirect reference to the page object with which this annotation is associated. This entry shall be present in screen annotations associated with rendition actions
page | the new page |
---|
PDFNetException |
---|
Set the size and location of an annotation on its page.
pos | the new bound rectangle |
---|
PDFNetException |
---|
Set the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90. (Optional)
Note: This property is part of the appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotation's visual presentation on the page.
rot | An integer representing the rotation value of the annotation. |
---|
PDFNetException |
---|
Set the struct parent of an annotation. (Required if the annotation is a structural content item; PDF'1.3)
Note: The StructParent is the integer key of the annotation's entry in the structural parent tree.
keyval | An integer which is the integer key of the annotation's entry in the structural parent tree. |
---|
PDFNetException |
---|
Set the unique identifier for this annotation.
Note: It is necessary to ensure that the unique ID generated is actually unique.
icon_name | the new unique id |
---|
PDFNetException |
---|