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
From class com.pdftron.pdf.Annot
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
From class com.pdftron.pdf.Annot
From class java.lang.Object

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

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.

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.

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.

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.

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.

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"

public double getFontSize ()

Returns the font size of the FreeText Annotation.

Returns
  • the font size

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".

public ColorPt getLineColor ()

Returns the line and border color of the FreeText Annotation.

Note: Current implementation of this method uses a non-standard entry in the annotation dictionary and will not return meaningful results when called on annotations not created with PDFTron software.

Returns
  • the line color

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

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.

public ColorPt getTextColor ()

Returns the text color of the FreeText Annotation.

Note: Current implementation of this method uses a non-standard entry in the annotation dictionary and will not return meaningful results when called on annotations not created with PDFTron software.

Returns
  • the text color

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

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.

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.

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.

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.

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"

public void setFontName (String fontName)

Sets the default font name of the FreeText Annotation.

Parameters
fontName font name

public void setFontSize (double font_size)

Sets the font size of the FreeText Annotation.

Parameters
font_size font size

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".

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.

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

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.