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

# FreeText

extends Markup

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

## Class Overview

A free text annotation (PDF 1.3) displays text directly on the page. Unlike an ordinary text annotation, a free text annotation has no open or closed state; instead of being displayed in a pop-up window, the text shall be always visible.

## Summary

Constants
int | e_FreeText | This integer list spedifies the intention of the FreeText annotation e_FreeText - The annotation ntended to function as a plain free-text annotation.
int | e_FreeTextCallout | The Constant e_FreeTextCallout.
int | e_FreeTextTypeWriter | The Constant e_FreeTextTypeWriter.
int | e_Unknown | The Constant e_Unknown.

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

Public Methods
static FreeText | create(Doc doc, Rect pos) Creates a new FreeText annotation, in the specified document.
Point | getCalloutLinePoint1() Get p1 of the callout line points of the FreeText annotation.
Point | getCalloutLinePoint2() Get p2 of the callout line points of the FreeText annotation.
Point | getCalloutLinePoint3() Get p3 of the callout line points of the FreeText annotation.
String | getDefaultAppearance() Get the default appearance of the FreeText annotation.
int | getEndingStyle() Get the ending style of the callout line of the FreeText Annotation.
double | getFontSize() Returns the font size of the FreeText Annotation.
int | getIntentName() Get the Intent name as an entry from the enum "IntentName" of the annnotation type.
ColorPt | getLineColor() Returns the line and border color of the FreeText Annotation.
int | getLineColorCompNum() Returns the number of color components in the line and border color of the FreeText Annotation.
int | getQuaddingFormat() Get the quading format of the FreeText annotation.
ColorPt | getTextColor() Returns the text color of the FreeText Annotation.
int | getTextColorCompNum() Returns the number of color components in the line and border color of the FreeText Annotation.
void | setCalloutLinePoints(Point p1, Point p2) Set the callout line points of the FreeText annotation.
void | setCalloutLinePoints(Point p1, Point p2, Point p3) Set the callout line points of the FreeText annotation.
void | setDefaultAppearance(String app_str) Set the default appearance of the FreeText annotation.
void | setEndingStyle(String est) Set the ending style of the callout line of the FreeText Annotation.
void | setEndingStyle(int est) Set the ending style of the callout line of the FreeText Annotation.
void | setFontName(String fontName) Sets the default font name of the FreeText Annotation.
void | setFontSize(double font_size) Sets the font size of the FreeText Annotation.
void | setIntentName(int mode) Set the Intent name as an entry from the enum "IntentName" of the annnotation type.
void | setLineColor(ColorPt color, int col_comp) Set the line and border color of the FreeText Annotation.
void | setQuaddingFormat(int app_qform) Set the quading format of the FreeText annotation.
void | setTextColor(ColorPt color, int col_comp) Set the text color of the FreeText Annotation.

[Expand] Inherited Methods
From class com.pdftron.pdf.annots.Markup
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.
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_FreeText

This integer list spedifies the intention of the FreeText annotation e_FreeText - The annotation ntended to function as a plain free-text annotation. A plain free-text annotation is also known as a text box comment. e_FreeTextCallout - The annotation is intended to function as a callout. The callout is associated with an area on the page through the callout line specified in CL. e_FreeTextTypeWriter - The annotation is intended to function as a click-to-type or typewriter object and no callout line is drawn. e_Unknow - Undefined (Userdefined) intent type.

Constant Value: 0 (0x00000000)

#### public static final int e_FreeTextCallout

The Constant e_FreeTextCallout.

Constant Value: 1 (0x00000001)

#### public static final int e_FreeTextTypeWriter

The Constant e_FreeTextTypeWriter.

Constant Value: 2 (0x00000002)

#### public static final int e_Unknown

The Constant e_Unknown.

Constant Value: 3 (0x00000003)

## Public Constructors

#### public FreeText (Obj d)

Creates an FreeText 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 | input Cos/SDF object

#### public FreeText ()

Creates an empty FreeText annotation.

#### public FreeText (Annot annot)

Creates an FreeText 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 | input annotation object

##### Throws

PDFNetException |

## Public Methods

#### public static FreeText create (Doc doc, Rect pos)

Creates a new FreeText annotation, in the specified document.

##### Parameters

doc | A document to which the FreeText annotation is added.
pos | A rectangle specifying the FreeText annotation's bounds, specified in user space coordinates.

##### Returns

- A newly created blank FreeText annotation.

##### Throws

PDFNetException |

#### public Point getCalloutLinePoint1 ()

Get p1 of the callout line points of the FreeText annotation.

Note: The returning values are two or three Point objects specifying a callout line attached to the free text annotation. Three Point objects represent the starting, knee point, and ending coordinates of the line in default user space, two Point objects represent the starting and ending coordinates of the line.

If the line is straight, i.e. only has two points, two valid points will be returned in p1 and p2, the p3 will be a point with negative x and y coordinate values.

##### Returns

- Three point objects if the line is bent or two point objects if the line is straight.

##### Throws

PDFNetException |

#### public Point getCalloutLinePoint2 ()

Get p2 of the callout line points of the FreeText annotation.

Note: The returning values are two or three Point objects specifying a callout line attached to the free text annotation. Three Point objects represent the starting, knee point, and ending coordinates of the line in default user space, two Point objects represent the starting and ending coordinates of the line.

If the line is straight, i.e. only has two points, two valid points will be returned in p1 and p2, the p3 will be a point with negative x and y coordinate values.

##### Returns

- Three point objects if the line is bent or two point objects if the line is straight.

##### Throws

PDFNetException |

#### public Point getCalloutLinePoint3 ()

Get p3 of the callout line points of the FreeText annotation.

Note: The returning values are two or three Point objects specifying a callout line attached to the free text annotation. Three Point objects represent the starting, knee point, and ending coordinates of the line in default user space, two Point objects represent the starting and ending coordinates of the line.

If the line is straight, i.e. only has two points, two valid points will be returned in p1 and p2, the p3 will be a point with negative x and y coordinate values.

##### Returns

- Three point objects if the line is bent or two point objects if the line is straight.

##### Throws

PDFNetException |

#### public String getDefaultAppearance ()

Get the default appearance of the FreeText annotation.

Note: The default appearance string shall be used in formatting the text.The annotation dictionary's Appearance (AP) entry, if present, shall take precedence over this entry.

##### Returns

- A string representing the default appearance of the FreeText annotation.

##### Throws

PDFNetException |

#### public int getEndingStyle ()

Get the ending style of the callout line of the FreeText Annotation.

Note: The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the starting point(p1) of the CallOut Line Points. Default value: e_None.

##### Returns

- The ending style represented as one of the entries of the enum "EndingStyle"

##### Throws

PDFNetException |

#### public double getFontSize ()

Returns the font size of the FreeText Annotation.

##### Returns

- the font size

##### Throws

PDFNetException |

#### public int getIntentName ()

Get the Intent name as an entry from the enum "IntentName" of the annnotation type.

Note: The intent name describes the intent of the free text annotation. The following values shall be valid: e_FreeText - The annotation is intended to function as a plain free-text annotation. A plain free-text annotation is also known as a text box comment. e_FreeTextCallout - The annotation is intended to function as a callout. The callout is associated with an area on the page through the callout line specified in CL. e_FreeTextTypeWriter - The annotation is intended to function as a click-to-type or typewriter object and no callout line is drawn. Default value: e_FreeText

##### Returns

- the intent nameThe intent name of the annotation as an entry from the enum "IntentName".

##### Throws

PDFNetException |

#### public ColorPt getLineColor ()

Returns the line and border color of the FreeText Annotation.

##### Returns

- the line color

##### Throws

PDFNetException |

#### public int getLineColorCompNum ()

Returns the number of color components in the line and border color of the FreeText Annotation.

##### Returns

- the line color comp num

##### Throws

PDFNetException |

#### public int getQuaddingFormat ()

Get the quading format of the FreeText annotation.

Note: The int code specifies the form of quadding (justification) that shall be used in displaying the annotation's text: 0Left-justified 1Centered 2Right-justified Default value: 0 (left-justified).

##### Returns

- A int code indicating the quading format of the FreeText annotation.

##### Throws

PDFNetException |

#### public ColorPt getTextColor ()

Returns the text color of the FreeText Annotation.

Note: In rich text annotations, some or all of the text may have a different color than the default text color.

##### Returns

- the text color

##### Throws

PDFNetException |

#### public int getTextColorCompNum ()

Returns the number of color components in the line and border color of the FreeText Annotation.

##### Returns

- the text color comp num

##### Throws

PDFNetException |

#### public void setCalloutLinePoints (Point p1, Point p2)

Set the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)

Note: The two Point objects specifies a callout line attached to the free text annotation. Tbe two Point objects represent the starting and ending coordinates of the line.

##### Parameters

p1 | The staring point.
p2 | The ending point.

##### Throws

PDFNetException |

#### public void setCalloutLinePoints (Point p1, Point p2, Point p3)

Set the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)

Note: The three Point objects specify a callout line attached to the free text annotation. The three Point objects represent the starting, knee point, and ending coordinates of the line in default user space.

##### Parameters

p1 | The staring point.
p2 | The ending point.
p3 | The knee point.

##### Throws

PDFNetException |

#### public void setDefaultAppearance (String app_str)

Set the default appearance of the FreeText annotation.

Note: The default appearance string shall be used in formatting the text.The annotation dictionary's Appearance (AP) entry, if present, shall take precedence over this entry.

##### Parameters

app_str | A string representing the default appearance of the FreeText annotation.

##### Throws

PDFNetException |

#### public void setEndingStyle (String est)

Set the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6)

Note: The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the starting point(p1) of the CallOut Line Points. Default value: "None".

##### Parameters

est | The ending style represented using a string.

##### Throws

PDFNetException |

#### public void setEndingStyle (int est)

Set the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6)

Note: The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the starting point(p1) of the CallOut Line Points. Default value: e_None.

##### Parameters

est | The ending style represented using one of the entries of the enum "EndingStyle"

##### Throws

PDFNetException |

#### public void setFontName (String fontName)

Sets the default font name of the FreeText Annotation.

##### Parameters

fontName | font name

##### Throws

PDFNetException |

#### public void setFontSize (double font_size)

Sets the font size of the FreeText Annotation.

##### Parameters

font_size | font size

##### Throws

PDFNetException |

#### public void setIntentName (int mode)

Set the Intent name as an entry from the enum "IntentName" of the annnotation type. (Optional; PDF 1.4)

Note: The intent name describes the intent of the free text annotation. The following values shall be valid: e_FreeText - The annotation is intended to function as a plain free-text annotation. A plain free - text annotation is also known as a text box comment. e_FreeTextCallout - The annotation is intended to function as a callout. The callout is associated with an area on the page through the callout line specified in CL. e_FreeTextTypeWriter - The annotation is intended to function as a click-to-type or typewriter object and no callout line is drawn. Default value: e_FreeText

##### Parameters

mode | The intent name of the annotation as an entry from the enum "IntentJName".

##### Throws

PDFNetException |

#### public void setLineColor (ColorPt color, int col_comp)

Set the line and border color of the FreeText Annotation.

Note: Current implementation of this method creates a non-standard entry in the annotation dictionary and uses it to generate the appearance stream. Make sure you call RefreshAppearance() after changing text or line color, and remember that editing the annotation in other PDF application will produce different appearance.

##### Parameters

color | ColorPt object representing the color.
col_comp | number of colorant components in ColorPt object.

##### Throws

PDFNetException |

#### public void setQuaddingFormat (int app_qform)

Set the quading format of the FreeText annotation. (Optional; PDF 1.4)

Note: The int code specifies the form of quadding (justification) that shall be used in displaying the annotation's text:

- 0 - Left-justified
- 1 - Centered
- 2 - Right-justified

Default value: 0 (left-justified).

##### Parameters

app_qform | the new quadding format

##### Throws

PDFNetException |

#### public void setTextColor (ColorPt color, int col_comp)

Set the text color of the FreeText Annotation.

Note: Current implementation of this method creates a non-standard entry in the annotation dictionary and uses it to generate the appearance stream. Make sure you call RefreshAppearance() after changing text or line color, and remember that editing the annotation in other PDF application will produce different appearance.

##### Parameters

color | ColorPt object representing the color.
col_comp | number of colorant components in ColorPt object.

##### Throws

PDFNetException |