Show / Hide Table of Contents

# Class FreeText

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.

##### Inheritance

object
Annot
Markup
FreeText

##### Implements

IDisposable

##### Inherited Members

Markup.GetTitle()
Markup.SetTitle(string)
Markup.GetPopup()
Markup.SetPopup(Popup)
Markup.GetOpacity()
Markup.SetOpacity(double)
Markup.GetSubject()
Markup.SetSubject(string)
Markup.GetCreationDates()
Markup.SetCreationDates(Date)
Markup.GetBorderEffect()
Markup.SetBorderEffect(Markup.BorderEffect)
Markup.GetBorderEffectIntensity()
Markup.SetBorderEffectIntensity(double)
Markup.GetInteriorColor()
Markup.GetInteriorColorCompNum()
Markup.SetInteriorColor(ColorPt, int)
Markup.GetContentRect()
Markup.SetContentRect(Rect)
Markup.GetPadding()
Markup.SetPadding(Rect)
Markup.RotateAppearance(double)
Annot.GetTriggerAction(Annot.EventType)
Annot.Create(SDFDoc, Annot.Type, Rect)
Annot.op_Assign(Annot)
Annot.Equals(object)
Annot.IsValid()
Annot.GetSDFObj()
Annot.GetType()
Annot.IsMarkup()
Annot.GetRect()
Annot.GetVisibleContentBox()
Annot.SetRect(Rect)
Annot.GetContents()
Annot.SetContents(string)
Annot.GetPage()
Annot.SetPage(Page)
Annot.GetUniqueID()
Annot.SetUniqueID(string)
Annot.GetDate()
Annot.SetDate(Date)
Annot.GetFlag(Annot.Flag)
Annot.SetFlag(Annot.Flag, bool)
Annot.GetBorderStyle()
Annot.SetBorderStyle(Annot.BorderStyle)
Annot.GetAppearance(Annot.AnnotationState, string)
Annot.GetAppearance(Annot.AnnotationState)
Annot.GetAppearance()
Annot.SetAppearance(Obj, Annot.AnnotationState, string)
Annot.SetAppearance(Obj, Annot.AnnotationState)
Annot.SetAppearance(Obj)
Annot.RemoveAppearance(Annot.AnnotationState, string)
Annot.RemoveAppearance(Annot.AnnotationState)
Annot.RemoveAppearance()
Annot.Flatten(Page)
Annot.GetActiveAppearanceState()
Annot.SetActiveAppearanceState(string)
Annot.GetColorAsRGB()
Annot.GetColorAsCMYK()
Annot.GetColorAsGray()
Annot.GetColorCompNum()
Annot.SetColor(ColorPt)
Annot.SetColor(ColorPt, int)
Annot.GetStructParent()
Annot.SetStructParent(int)
Annot.GetOptionalContent()
Annot.SetOptionalContent(Obj)
Annot.Resize(Rect)
Annot.GetRotation()
Annot.SetRotation(int)
Annot.RefreshAppearance(RefreshOptions)
Annot.RefreshAppearance()
Annot.GetCustomData(string)
Annot.SetCustomData(string, string)
Annot.DeleteCustomData(string)
Annot.Dispose()
object.ToString()
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.MemberwiseClone()

###### Namespace: pdftron.PDF.Annots

###### Assembly: PDFNet.dll

##### Syntax

    public class FreeText : Markup, IDisposable

### Constructors

#### FreeText(Annot)

Creates an FreeText annotation and initialize it using given annotation object.

##### Declaration

    public FreeText(Annot ann)

##### Parameters

Type | Name | Description
--- | --- | ---
Annot | ann | the annot

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### FreeText(Obj)

Creates an FreeText annotation and initialize it using given Cos/SDF object.

##### Declaration

    public FreeText(Obj d)

##### Parameters

Type | Name | Description
--- | --- | ---
Obj | d | the d

##### Remarks

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

### Methods

#### Create(SDFDoc, Rect)

Creates a new FreeText annotation, in the specified document.

##### Declaration

    public static FreeText Create(SDFDoc doc, Rect pos)

##### Parameters

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

##### Returns

Type | Description
--- | ---
FreeText | A newly created blank FreeText annotation.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Dispose(bool)

##### Declaration

    [HandleProcessCorruptedStateExceptions]
    protected override void Dispose(bool A_0)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | A_0 |

##### Overrides

Markup.Dispose(bool)

#### ~FreeText()

##### Declaration

    protected ~FreeText()

#### GetCalloutLinePoints(Point, Point, Point)

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

##### Declaration

    public void GetCalloutLinePoints(Point out_p1, Point out_p2, Point out_p3)

##### Parameters

Type | Name | Description
--- | --- | ---
Point | out_p1 | The starting point.
Point | out_p2 | The ending point.
Point | out_p3 | The knee point.

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetDefaultAppearance()

Gets the default appearance of the FreeText annotation.

##### Declaration

    public string GetDefaultAppearance()

##### Returns

Type | Description
--- | ---
string | A string representing the default appearance of the FreeText annotation.

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetEndingStyle()

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

##### Declaration

    public Line.EndingStyle GetEndingStyle()

##### Returns

Type | Description
--- | ---
Line.EndingStyle | The ending style represented as one of the entries of the enum "EndingStyle"

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetFontSize()

Returns the font size of the FreeText Annotation.

##### Declaration

    public double GetFontSize()

##### Returns

Type | Description
--- | ---
double | the font size

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetIntentName()

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

##### Declaration

    public FreeText.IntentName GetIntentName()

##### Returns

Type | Description
--- | ---
FreeText.IntentName | the intent name

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetLineColor()

Returns the line and border color of the FreeText Annotation.

##### Declaration

    public ColorPt GetLineColor()

##### Returns

Type | Description
--- | ---
ColorPt | the line color

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetLineColorCompNum()

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

##### Declaration

    public int GetLineColorCompNum()

##### Returns

Type | Description
--- | ---
int | the line color comp num

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetQuaddingFormat()

Gets the quading format of the FreeText annotation.

##### Declaration

    public int GetQuaddingFormat()

##### Returns

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

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetTextColor()

Returns the text color of the FreeText Annotation.

##### Declaration

    public ColorPt GetTextColor()

##### Returns

Type | Description
--- | ---
ColorPt | the text color

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetTextColorCompNum()

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

##### Declaration

    public int GetTextColorCompNum()

##### Returns

Type | Description
--- | ---
int | the text color comp num

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetCalloutLinePoints(Point, Point)

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

##### Declaration

    public void SetCalloutLinePoints(Point p1, Point p2)

##### Parameters

Type | Name | Description
--- | --- | ---
Point | p1 | The staring point.
Point | p2 | The ending point.

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetCalloutLinePoints(Point, Point, Point)

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

##### Declaration

    public void SetCalloutLinePoints(Point p1, Point p2, Point p3)

##### Parameters

Type | Name | Description
--- | --- | ---
Point | p1 | The staring point.
Point | p2 | The ending point.
Point | p3 | The kee point.

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetDefaultAppearance(string)

Sets the default appearance of the FreeText annotation.

##### Declaration

    public void SetDefaultAppearance(string app_str)

##### Parameters

Type | Name | Description
--- | --- | ---
string | app_str | A string representing the default appearance of the FreeText annotation.

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetEndingStyle(string)

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

##### Declaration

    public void SetEndingStyle(string est)

##### Parameters

Type | Name | Description
--- | --- | ---
string | est | The ending style represented using a string.

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetEndingStyle(EndingStyle)

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

##### Declaration

    public void SetEndingStyle(Line.EndingStyle est)

##### Parameters

Type | Name | Description
--- | --- | ---
Line.EndingStyle | est | The ending style represented using one of the entries of the enum "EndingStyle"

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetFontName(string)

Sets the default font name of the FreeText Annotation.

##### Declaration

    public void SetFontName(string fontName)

##### Parameters

Type | Name | Description
--- | --- | ---
string | fontName | the font name

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetFontSize(double)

Sets the font size of the FreeText Annotation.

##### Declaration

    public void SetFontSize(double font_size)

##### Parameters

Type | Name | Description
--- | --- | ---
double | font_size | the font size

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetIntentName()

Sets the Intent name to e_FreeText.

##### Declaration

    public void SetIntentName()

#### SetIntentName(IntentName)

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

##### Declaration

    public void SetIntentName(FreeText.IntentName mode)

##### Parameters

Type | Name | Description
--- | --- | ---
FreeText.IntentName | mode | The intent name of the annotation as an entry from the enum "IntentJName".

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetLineColor(ColorPt, int)

Sets the line and border color of the FreeText Annotation.

##### Declaration

    public void SetLineColor(ColorPt color, int col_comp)

##### Parameters

Type | Name | Description
--- | --- | ---
ColorPt | color | ColorPt object representing the color.
int | col_comp | number of colorant components in ColorPt object.

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetQuaddingFormat(int)

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

##### Declaration

    public void SetQuaddingFormat(int app_qform)

##### Parameters

Type | Name | Description
--- | --- | ---
int | app_qform | the new quadding format

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetTextColor(ColorPt, int)

Sets the text color of the FreeText Annotation.

##### Declaration

    public void SetTextColor(ColorPt color, int col_comp)

##### Parameters

Type | Name | Description
--- | --- | ---
ColorPt | color | ColorPt object representing the color.
int | col_comp | number of colorant components in ColorPt object.

##### Remarks

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.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

### Implements

IDisposable