public class

Text

extends Markup
java.lang.Object
   ↳ com.pdftron.pdf.Annot
     ↳ com.pdftron.pdf.annots.Markup
       ↳ com.pdftron.pdf.annots.Text

Class Overview

A text annotation represents a "sticky note" attached to a point in the PDF document. When closed, the annotation shall appear as an icon; when open, it shall display a pop-up window containing the text of the note in a font and size chosen by the conforming reader. Text annotations shall not scale and rotate with the page; they shall behave as if the NoZoom and NoRotate annotation flags.

Summary

Constants
int e_Comment This integer list represents type of icon corresponding with the Text annotation.
int e_Help The Constant e_Help.
int e_Insert The Constant e_Insert.
int e_Key The Constant e_Key.
int e_NewParagraph The Constant e_NewParagraph.
int e_Note The Constant e_Note.
int e_Paragraph The Constant e_Paragraph.
int e_Unknown The Constant e_Unknown.
[Expand]
Inherited Constants
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
Public Constructors
Text(Obj d)
Creates a Text annotation and initialize it using given Cos/SDF object.
Text()
Creates an empty Text annotation.
Text(Annot annot)
Creates a Text annotation and initialize it using given annotation object.
Public Methods
static Text create(Doc doc, Point pos, String contents)
Creates a new Text annotation, in the specified document.
static Text create(Doc doc, Point pos)
Creates a new Text annotation, in the specified document.
Point getAnchorPosition()
Returns anchor point position (in relative coordinates) - the point that won't move when the page is zoomed in/out Anchor point position is in relative coordinates [0,1], and default is upper-left corner (0,1)
int getIcon()
Get the Icon type as an entry of the enum "Icon".
String getIconName()
Get the string indicating the type of icon corresponding to the Text annotation.
String getState()
Get the string indicating the state of the Text annotation.
String getStateModel()
Get the string indicating the state model of the Text annotation.
void setAnchorPosition(Point pt)
Sets anchor point position (in coordinates relative to the annotation Rect) - the point that won't move when the page is zoomed in/out and/or if the page is rotated.
void setIcon(int icon)
Set the Icon type as an entry of the enum "Icon".
void setIcon(String icon)
Set the string indicating the type of icon corresponding to (Optional).
void setState(String state)
Set the string indicating the state of the Text annotation.
void setStateModel(String statemodule)
Set the string indicating the state model of the Text annotation.
[Expand]
Inherited Methods
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
From class java.lang.Object

Constants

public static final int e_Comment

This integer list represents type of icon corresponding with the Text annotation. e_Comment, e_Key, e_Help, e_NewParagraph, e_Paragraph, e_Insert, e_Note, e_Unknown - This corresponds to user defined names.

Constant Value: 0 (0x00000000)

public static final int e_Help

The Constant e_Help.

Constant Value: 2 (0x00000002)

public static final int e_Insert

The Constant e_Insert.

Constant Value: 5 (0x00000005)

public static final int e_Key

The Constant e_Key.

Constant Value: 1 (0x00000001)

public static final int e_NewParagraph

The Constant e_NewParagraph.

Constant Value: 3 (0x00000003)

public static final int e_Note

The Constant e_Note.

Constant Value: 6 (0x00000006)

public static final int e_Paragraph

The Constant e_Paragraph.

Constant Value: 4 (0x00000004)

public static final int e_Unknown

The Constant e_Unknown.

Constant Value: 7 (0x00000007)

Public Constructors

public Text (Obj d)

Creates a Text 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 Text ()

Creates an empty Text annotation.

public Text (Annot annot)

Creates a Text 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

Public Methods

public static Text create (Doc doc, Point pos, String contents)

Creates a new Text annotation, in the specified document.

Parameters
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, specified in user space coordinates.
contents The text contents of the Text annotation.
Returns
  • A newly created Text annotation.

public static Text create (Doc doc, Point pos)

Creates a new Text annotation, in the specified document.

Parameters
doc A document to which the annotation is added.
pos A rectangle specifying the annotation's bounds, specified in user space coordinates.
Returns
  • A newly created blank Text annotation.

public Point getAnchorPosition ()

Returns anchor point position (in relative coordinates) - the point that won't move when the page is zoomed in/out Anchor point position is in relative coordinates [0,1], and default is upper-left corner (0,1)

Returns
  • Currently stored anchor position or the default (upper-left corner (0,1))

public int getIcon ()

Get the Icon type as an entry of the enum "Icon".

Note: The icon type represnets the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard icon types: e_Comment, e_Key, e_Note, e_Help, e_NewParagraph, e_Paragraph, e_Insert Additional names may be supported as well. Default value: e_Note. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over this Name entry.

Returns
  • An entry of "Icon" that represents the type of icon that is corresponding with this Text annotation.

public String getIconName ()

Get the string indicating the type of icon corresponding to the Text annotation.

Note: the icon type represnets the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard icon types: e_Comment, e_Key, e_Note, e_Help, e_NewParagraph, e_Paragraph, e_Insert Additional names may be supported as well. Default value: Note. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over this Name entry.

Returns
  • A string that represents the type of icon that is corresponding with this Text annotation.

public String getState ()

Get the string indicating the state of the Text annotation.

Returns
  • A string that represents the state of the Text annotation.
Throws
PDFNetException

* Note: The state is a state to which the original annotation shall be set. Default: "Unmarked" if StateModel is "Marked"; "None" if StateModel is "Review".

public String getStateModel ()

Get the string indicating the state model of the Text annotation.

Returns
  • A string that represents the state model of the Text annotation.
Throws
PDFNetException

* Note: The State model is the state model corresponding to the State entry;

public void setAnchorPosition (Point pt)

Sets anchor point position (in coordinates relative to the annotation Rect) - the point that won't move when the page is zoomed in/out and/or if the page is rotated.

Parameters
pt Anchor point position in relative coordinates [0,1], where 0,0 is bottom left corner of the annotation, and 1,1 is top right corner. Default: 0,1

public void setIcon (int icon)

Set the Icon type as an entry of the enum "Icon". (Optional)

Parameters
icon An entry of "Icon" that represents the type of icon that is corresponding with this Text annotation.
Throws
PDFNetException

* Note: the icon type represnets the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard icon names: Comment, Key, Note, Help, NewParagraph, Paragraph, Insert Additional names may be supported as well. Default value: e_Note. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over this Name entry.

public void setIcon (String icon)

Set the string indicating the type of icon corresponding to (Optional).

Parameters
icon A string that represents the type of icon that is corresponding with this Text annotation.
Throws
PDFNetException

* Note: the icon type represnets the name of an icon that shall be used in displaying the annotation. Conforming readers shall provide predefined icon appearances for at least the following standard icon types: e_Comment, e_Key, e_Note, e_Help, e_NewParagraph, e_Paragraph, e_Insert Additional names may be supported as well. Default value: Note. The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over this Name entry.

public void setState (String state)

Set the string indicating the state of the Text annotation. (Optional; PDF 1.5 )

Parameters
state A string that represents the state of the Text annotation.
Throws
PDFNetException

* Note: The state is a state to which the original annotation shall be set. Default: "Unmarked" if StateModel is "Marked"; "None" if StateModel is "Review".

public void setStateModel (String statemodule)

Set the string indicating the state model of the Text annotation. (Required if State is present, otherwise optional; PDF 1.5 )

Parameters
statemodule - A string that represents the state model of the Text annotation.
Throws
PDFNetException

* Note: The State model is the state model corresponding to the State entry;