Summary: Constants | Inherited Constants | Ctors | Methods | Inherited Methods | [Expand All]
public class

# Markup

extends Annot

java.lang.Object
↳ | com.pdftron.pdf.Annot
| ↳ | com.pdftron.pdf.annots.Markup

Known Direct Subclasses Caret, Circle, FileAttachment, FreeText, Ink, Line, Redaction, RubberStamp, Sound, Square, Text, TextMarkup
Caret | A Caret annotation (PDF 1.5) is a visual symbol that indicates the presence of text edits.
Circle | Square and circle annotations (PDF 1.3) shall display, respectively, a rectangle or an ellipse on the page.
FileAttachment | A file attachment annotation (PDF 1.3) contains a reference to a file, which typically shall be embedded in the PDF file.
FreeText | A free text annotation (PDF 1.3) displays text directly on the page.
Ink | An ink annotation (PDF 1.3) represents a freehand "scribble" composed of one or more disjoint paths.
Line | The purpose of a line annotation (PDF 1.3) is to display a single straight line on the page.
Redaction | A redaction annotation (PDF 1.7) identifies content that is intended to be removed from the document.
RubberStamp | A rubber stamp annotation (PDF 1.3) displays text or graphics intended to look as if they were stamped on the page with a rubber stamp.
Sound | A sound annotation (PDF 1.2) shall analogous to a text annotation except that instead of a text note, it contains sound recorded from the computer's microphone or imported from a file.
Square | Square and circle annotations (PDF 1.3) shall display, respectively, a rectangle or an ellipse on the page.
Text | A text annotation represents a "sticky note" attached to a point in the PDF document.
TextMarkup | Text markup annotations shall appear as highlights, underlines, strikeouts (all PDF 1.3), or jagged ("squiggly") underlines (PDF 1.4) in the text of a document.

Known Indirect Subclasses Highlight, PolyLine, Polygon, Squiggly, StrikeOut, Underline
Highlight | Text markup annotations shall appear as highlights, underlines, strikeouts (all PDF 1.3), or jagged ("squiggly") underlines (PDF 1.4) in the text of a document.
PolyLine | Polyline annotations (PDF 1.5) display (open or closed) shapes of multiple edges on the page.
Polygon | The Polygon class.
Squiggly | TextMarkup annotations shall appear as highlights, underlines, strikeouts (all PDF 1.3), or jagged ("squiggly") underlines (PDF 1.4) in the text of a document.
StrikeOut | TextMarkup annotations shall appear as highlights, underlines, strikeouts (all PDF 1.3), or jagged ("squiggly") underlines (PDF 1.4) in the text of a document.
Underline | Text markup annotations shall appear as highlights, underlines, strikeouts (all PDF 1.3), or jagged ("squiggly") underlines (PDF 1.4) in the text of a document.

## Class Overview

The meaning of an annotation's Contents entry varies by annotation type. Typically, it is the text that shall be displayed for the annotation or, if the annotation does not display text, an alternate description of the annotation's contents in human-readable form. In either case, the Contents entry is useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes. Many annotation types are defined as markup annotations because they are used primarily to mark up PDF documents. These annotations have text that appears as part of the annotation and may be displayed in other ways by a conforming reader, such as in a Comments pane. Markup annotations may be divided into the following groups: Free text annotations display text directly on the page. The annotation's Contents entry specifies the displayed text. Most other markup annotations have an associated pop-up window that may contain text. The annotation's Contents entry specifies the text that shall be displayed when the pop-up window is opened. These include text, line, square, circle, polygon, polyline, highlight,underline, squiggly-underline, strikeout, rubber stamp, caret, ink, and file attachment annotations. Sound annotations do not have a pop-up window but may also have associated text specified by the Contents entry. When separating text into paragraphs, a CARRIAGE RETURN (0Dh) shall be used and not, for example, a LINE FEED character (0Ah). NOTE 1 A subset of markup annotations is called text markup annotations. The remaining annotation types are not considered markup annotations: The pop-up annotation type shall not appear by itself; it shall be associated with a markup annotation that uses it to display text. NOTE 2If an annotation has no parent, the Contents entry shall represent the text of the annotation, otherwise it shall be ignored by a conforming reader. For all other annotation types (Link, Movie, Widget, PrinterMark, and TrapNet), the Contents entry shall provide an alternate representation of the annotation's contents in human-readable form, which is useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes.

## Summary

Constants
int | e_Cloudy | The Constant e_Cloudy.
int | e_None | This integer list represents the Border Effect of the Markup annotation e_None - No effect e_Cloudy - The border should appear "cloudy".

[Expand] Inherited Constants
From class com.pdftron.pdf.Annot
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
| Markup(Obj d) Creates a Markup annotation and initialize it using given Cos/SDF object.
| Markup() Creates an empty Markup annotation.
| Markup(Annot annot) Creates a Markup annotation and initialize it using given annotation object.

Public Methods
int | getBorderEffect() Gets the Border Effect of the Markup Annotation.
double | getBorderEffectIntensity() Gets the Border Effect Intensity of the Markup Annotation.
Rect | getContentRect() Gets the inner bounding rectangle of the Square.
Date | getCreationDates() Gets the creation date of the Markup Annotation.
ColorPt | getInteriorColor() Gets the interior color of the Square.
int | getInteriorColorCompNum() Gets the number indicating interior color space of the Square.
double | getOpacity() Gets the contant opacity value corresponding to the annotation.
Rect | getPadding() Gets the rectangle difference of the Square.
Popup | getPopup() Gets the Popup object associated with this Markup annotation.
String | getSubject() Gets subject of the Markup Annotation.
String | getTitle() Gets the title of the Markup Annotation.
void | rotateAppearance(double angle) Rotates the appearance of the Markup Annotation.
void | setBorderEffect(int effect) Sets the Border Effect of the Markup Annotation.
void | setBorderEffectIntensity(double intensity) Sets the Border Effect Intensity of the Markup Annotation.
void | setContentRect(Rect cr) Sets the inner bounding rectangle of the Square.
void | setCreationDates(Date date) Sets the creation date of the Markup Annotation.
void | setInteriorColor(ColorPt cpt, int comp_num) Sets the interior color of the Square.
void | setOpacity(double opacity) Sets the contant opacity value corresponding to the annotation.
void | setPadding(double padding) Sets the rectangle difference of the Square.
void | setPadding(Rect rd) Sets the rectangle difference of the Square.
void | setPopup(Popup popup) Sets the Popup object associated with this Markup annotation.
void | setSubject(String title) Sets subject of the Markup Annotation.
void | setTitle(String title) Sets the title of the Markup Annotation.

[Expand] Inherited Methods
From class com.pdftron.pdf.Annot
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.
From class java.lang.Object
boolean | equals(Object arg0)
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Constants

#### public static final int e_Cloudy

The Constant e_Cloudy.

Constant Value: 1 (0x00000001)

#### public static final int e_None

This integer list represents the Border Effect of the Markup annotation e_None - No effect e_Cloudy - The border should appear "cloudy". The width and dash array specified by Border Style shall be honored.

Constant Value: 0 (0x00000000)

## Public Constructors

#### public Markup (Obj d)

Creates a Markup 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.

##### Parameters

d | the input Cos/SDF object

#### public Markup ()

Creates an empty Markup annotation.

#### public Markup (Annot annot)

Creates a Markup annotation and initialize it using given annotation object.

Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.

##### Parameters

annot | the annot

##### Throws

PDFNetException |

## Public Methods

#### public int getBorderEffect ()

Gets the Border Effect of the Markup Annotation.

Note: The BorderEffect value is an entry in the "BorderEffect" enum, representing the border effect to apply. Possible values are: e_None - No effect: the border shall be as described by the annotation dictionary's BorderStyle(BS) entry. e_Cloudy - The border should appear "cloudy". The width and dash array specified by BS shall be honored. Default value: e_None.

##### Returns

- An entry from the enum "BorderEffect" that represents the border effect.

##### Throws

PDFNetException |

#### public double getBorderEffectIntensity ()

Gets the Border Effect Intensity of the Markup Annotation.

Note: The BorderEffectIntensity value is a number describing the intensity of the effect, in the range 0 to 2. Default value: 0.

##### Returns

- A number representing the border effect.

##### Throws

PDFNetException |

#### public Rect getContentRect ()

Gets the inner bounding rectangle of the Square. (Optional; PDF 1.5)

##### Returns

- A difference between the inner bounding rectangle and a positon rectangle may occur in situations where a border effect (described by BE) causes the size of the Rect to increase beyond that of the square or Square

##### Throws

PDFNetException |

#### public Date getCreationDates ()

Gets the creation date of the Markup Annotation.

Note: The Date object not only includes date, it actually includes both date and time when the annotation was created.

This corresponds to the 'CreationDate' field of the markup annotation's dictionary.

##### Returns

- A Date object indicating the date the Markup Annotation is created.

##### Throws

PDFNetException |

#### public ColorPt getInteriorColor ()

Gets the interior color of the Square.

Note: that the color can be in different color spaces: Gray, RGB, or CMYK. Call "GetInteriorColorCompNum" to access the color space information corresponding to the interioir color.

##### Returns

- A ColorPt object that denotes the color of the Square.

##### Throws

PDFNetException |

#### public int getInteriorColorCompNum ()

Gets the number indicating interior color space of the Square.

##### Returns

- An integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk" if color space is applicable, orelse 0 corresponding to "e_null" if the color is transparent.

##### Throws

PDFNetException |

#### public double getOpacity ()

Gets the contant opacity value corresponding to the annotation.

Note: The constant opacity value shall be used in painting the annotation. This value shall apply to all visible elements of the annotation in its closed state (including its background and border) but not to the pop-up window that appears when the annotation is opened. The specified value shall not used if the annotation has an appearance stream in that case, the appearance stream shall specify any transparency. (However, if the compliant viewer regenerates the annotation's appearance stream, it may incorporate the CA value into the stream's content.) The implicit blend mode is Normal. Default value: 1.0. If no explicit appearance stream is defined for the annotation, it may bepainted by implementation-dependent means that do not necessarily conform to the PDF imaging model; in this case, the effect of this entry is implementation-dependent as well.

##### Returns

- A number indicating the opacity value corresponding to the annotation.

##### Throws

PDFNetException |

#### public Rect getPadding ()

Gets the rectangle difference of the Square. (Optional; PDF 1.5)

Note: rectangle difference is A set of four numbers that shall describe the numerical differences between two rectangles: the Rect entry of the annotation and the actual boundaries of the underlying square or Square. Such a difference may occur in situations where a border effect (described by BE) causes the size of the Rect to increase beyond that of the square or Square. The four numbers shall correspond to the differences in default user space between the left, top, right, and bottom coordinates of Rect and those of the square or Square, respectively. Each value shall be greater than or equal to 0. The sum of the top and bottom differences shall be less than the height of Rect, and the sum of the left and right differences shall be less than the width of Rect.

##### Returns

- A set of four numbers(represented as a Rect object) specifying the difference on the four different directions.

##### Throws

PDFNetException |

#### public Popup getPopup ()

Gets the Popup object associated with this Markup annotation.

Note: The Popup is An indirect reference to a pop-up annotation for entering or editing the text associated with this annotation.

##### Returns

- A Popup object that is associated with this Markup annotation.

##### Throws

PDFNetException |

#### public String getSubject ()

Gets subject of the Markup Annotation.

Note: The subject is The Text representing a short description of the subject being addressed by the annotation.

##### Returns

- A string representing the subject of the Markup Annotation

##### Throws

PDFNetException |

#### public String getTitle ()

Gets the title of the Markup Annotation.

Note: 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. This entry shall identify the user who added the annotation.

##### Returns

- A string representing the title of the Markup Annotation

##### Throws

PDFNetException |

#### public void rotateAppearance (double angle)

Rotates the appearance of the Markup Annotation.

Note: Apply a rotation to an existing appearance. This rotation will be reflected in the bounding rect of the annot (which will be updated), but not in any other part of the annotation dictionary. This will effectively create a custom appearance for the annotation, and any subsequent calls to `RefreshAppearance` will clear this transformation.

##### Parameters

angle | the new rotation.

##### Throws

PDFNetException |

#### public void setBorderEffect (int effect)

Sets the Border Effect of the Markup Annotation. (Optional; PDF 1.5 )

Note: The BorderEffect value is an entry in the "BorderEffect" enum, representing the border effect to apply. Possible values are: e_None - No effect: the border shall be as described by the annotation dictionary's BorderStyle(BS) entry. e_Cloudy - The border should appear "cloudy". The width and dash array specified by BS shall be honored. Default value: e_None.

##### Parameters

effect | An entry from the enum "BorderEffect" that represents the border effect.

##### Throws

PDFNetException |

#### public void setBorderEffectIntensity (double intensity)

Sets the Border Effect Intensity of the Markup Annotation. (Optional; valid only if Border effect is Cloudy)

Note: The BorderEffectIntensity value is a number describing the intensity of the effect, in the range 0 to 2. Default value: 0.

##### Parameters

intensity | A number representing the border effect.

##### Throws

PDFNetException |

#### public void setContentRect (Rect cr)

Sets the inner bounding rectangle of the Square. (Optional; PDF 1.5)

##### Parameters

cr | the new content rect

##### Throws

PDFNetException |

#### public void setCreationDates (Date date)

Sets the creation date of the Markup Annotation. (Optional; PDF 1.5 )

Note: The Date object not only includes date, it actually includes both date and time when the annotation was created.

This corresponds to the 'CreationDate' field of the markup annotation's dictionary.

##### Parameters

date | the new creation dates

##### Throws

PDFNetException |

#### public void setInteriorColor (ColorPt cpt, int comp_num)

Sets the interior color of the Square. (Optional; PDF 1.4 )

Note: it is necessary to make sure the consistancy between the ColorPt type and the ColorSpace::Type value. e_device_gray corresponds to an array of two numbers; e_device_rgb corresponds to an array of 3 numbers, e_device_cmyk corresponds to an array of 4 numnbers, while e_null correspons to an arry of 0 number. Entries out of the specified color space array length will be desgarded. However, missing entries for a specified color space will throw exception either when setting the color or when later retrieving color(colorspace) information.

##### Parameters

cpt | the cpt
comp_num | the comp_num

##### Throws

PDFNetException |

#### public void setOpacity (double opacity)

Sets the contant opacity value corresponding to the annotation. (Optional; PDF 1.4 )

Note: The constant opacity value shall be used in painting the annotation. This value shall apply to all visible elements of the annotation in its closed state (including its background and border) but not to the pop-up window that appears when the annotation is opened. The specified value shall not used if the annotation has an appearance stream in that case, the appearance stream shall specify any transparency. (However, if the compliant viewer regenerates the annotation's appearance stream, it may incorporate the CA value into the stream's content.) The implicit blend mode is Normal. Default value: 1.0. If no explicit appearance stream is defined for the annotation, it may bepainted by implementation-dependent means that do not necessarily conform to the PDF imaging model; in this case, the effect of this entry is implementation-dependent as well.

##### Parameters

opacity | the new opacity

##### Throws

PDFNetException |

#### public void setPadding (double padding)

Sets the rectangle difference of the Square. (Optional; PDF 1.5)

##### Parameters

padding | a number specifying the padding to be applied on each side.

##### Throws

PDFNetException |

##### See Also

- setPadding

#### public void setPadding (Rect rd)

Sets the rectangle difference of the Square. (Optional; PDF 1.5)

Note: rectangle difference is A set of four numbers that shall describe the numerical differences between two rectangles: the Rect entry of the annotation and the actual boundaries of the underlying square or Square. Such a difference may occur in situations where a border effect (described by BE) causes the size of the Rect to increase beyond that of the square or Square. The four numbers shall correspond to the differences in default user space between the left, top, right, and bottom coordinates of Rect and those of the square or Square, respectively. Each value shall be greater than or equal to 0. The sum of the top and bottom differences shall be less than the height of Rect, and the sum of the left and right differences shall be less than the width of Rect.

##### Parameters

rd | A set of four numbers(represented as a Rect object) specifying the difference on the four different directions.

##### Throws

PDFNetException |

#### public void setPopup (Popup popup)

Sets the Popup object associated with this Markup annotation. (Optional; PDF 1.3 )

Note: the Popup is An indirect reference to a pop-up annotation for entering or editing the text associated with this annotation.

##### Parameters

popup | the new popup

##### Throws

PDFNetException |

#### public void setSubject (String title)

Sets subject of the Markup Annotation. (Optional; PDF 1.5 )

Note: The subject is The Text representing a short description of the subject being addressed by the annotation.

##### Parameters

title | the new subject

##### Throws

PDFNetException |

#### public void setTitle (String title)

Sets the title of the Markup Annotation. (Optional; PDF 1.1)

Note: 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. This entry shall identify the user who added the annotation.

##### Parameters

title | A string representing the title of the Markup Annotation

##### Throws

PDFNetException |