# FreeTextAnnotation

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / FreeTextAnnotation

# Class: FreeTextAnnotation

Represents a free text annotation that displays text directly on a page.
Unlike an ordinary text annotation ([TextAnnotation](TextAnnotation)),
a free text annotation has no open or closed state.
Instead of being displayed in a pop-up window, the text is always visible.

## Extends

- [`MarkupAnnotation`](MarkupAnnotation)

## Constructors

### Constructor

> **new FreeTextAnnotation**(`om`): `FreeTextAnnotation`

Creates a new FreeTextAnnotation.

#### Parameters

##### om

[`ObjectManager`](ObjectManager)

[ObjectManager](ObjectManager) that controls the lifetime of the FreeTextAnnotation.

#### Returns

`FreeTextAnnotation`

#### Overrides

`MarkupAnnotation.constructor`

### Constructor

> **new FreeTextAnnotation**(): `FreeTextAnnotation`

Creates a new FreeTextAnnotation.

#### Returns

`FreeTextAnnotation`

#### Overrides

`MarkupAnnotation.constructor`

## Accessors

### calloutLine

#### Get Signature

> **get** **calloutLine**(): [`Point`](../type-aliases/Point)[] \| `null`

Gets or sets an array of 2 or 3 [Point](../type-aliases/Point) structures specifying a callout line attached to the free text annotation.
3 points represent the starting coordinates, the knee point, and the ending coordinates of the line.
2 points represent the starting and ending coordinates of the line.
The coordinates are in default user space relative to the upper left corner of the page's media box,
with the Y (vertical) coordinates increasing from top to bottom.

##### Returns

[`Point`](../type-aliases/Point)[] \| `null`

#### Set Signature

> **set** **calloutLine**(`value`): `void`

Gets or sets an array of 2 or 3 [Point](../type-aliases/Point) structures specifying a callout line attached to the free text annotation.
3 points represent the starting coordinates, the knee point, and the ending coordinates of the line.
2 points represent the starting and ending coordinates of the line.
The coordinates are in default user space relative to the upper left corner of the page's media box,
with the Y (vertical) coordinates increasing from top to bottom.

##### Parameters

###### value

[`Point`](../type-aliases/Point)[] | `null`

##### Returns

`void`

***

### color

#### Get Signature

> **get** **color**(): [`Color`](../type-aliases/Color)

Gets or sets the annotation color,
it used as color of popup window, lines color etc.

##### Returns

[`Color`](../type-aliases/Color)

#### Set Signature

> **set** **color**(`value`): `void`

Gets or sets the annotation color,
it used as color of popup window, lines color etc.

##### Parameters

###### value

[`Color`](../type-aliases/Color)

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`color`](MarkupAnnotation#color)

***

### contents

#### Get Signature

> **get** **contents**(): `string` \| `null`

Gets or sets the text to be displayed for the annotation or,
if this type of annotation does not display text,
an alternate description of the annotation's contents in human-readable form.
In either case, this text is useful when extracting the document's contents in support of accessibility
to users with disabilities or for other purposes.

##### Returns

`string` \| `null`

#### Set Signature

> **set** **contents**(`value`): `void`

Gets or sets the text to be displayed for the annotation or,
if this type of annotation does not display text,
an alternate description of the annotation's contents in human-readable form.
In either case, this text is useful when extracting the document's contents in support of accessibility
to users with disabilities or for other purposes.

##### Parameters

###### value

`string` | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`contents`](MarkupAnnotation#contents)

***

### creationDate

#### Get Signature

> **get** **creationDate**(): [`PdfDateTime`](../type-aliases/PdfDateTime) \| `null`

Gets or sets the date and time when the annotation was created.

##### Returns

[`PdfDateTime`](../type-aliases/PdfDateTime) \| `null`

#### Set Signature

> **set** **creationDate**(`value`): `void`

Gets or sets the date and time when the annotation was created.

##### Parameters

###### value

[`PdfDateTime`](../type-aliases/PdfDateTime) | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`creationDate`](MarkupAnnotation#creationdate)

***

### defaultAppearance

#### Get Signature

> **get** **defaultAppearance**(): [`DefaultAppearance`](DefaultAppearance)

Gets the [DefaultAppearance](DefaultAppearance) object that specifies
the visual properties (font, font size etc.) used to format the content of the annotation.

##### Returns

[`DefaultAppearance`](DefaultAppearance)

***

### doc

#### Get Signature

> **get** **doc**(): [`PdfDocument`](PdfDocument) \| `null`

Gets the [PdfDocument](PdfDocument) owning this annotation.

##### Returns

[`PdfDocument`](PdfDocument) \| `null`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`doc`](MarkupAnnotation#doc)

***

### flags

#### Get Signature

> **get** **flags**(): [`AnnotationFlags`](../enumerations/AnnotationFlags)

Gets or sets the flags specifying various characteristics of the annotation.

##### Returns

[`AnnotationFlags`](../enumerations/AnnotationFlags)

#### Set Signature

> **set** **flags**(`value`): `void`

Gets or sets the flags specifying various characteristics of the annotation.

##### Parameters

###### value

[`AnnotationFlags`](../enumerations/AnnotationFlags)

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`flags`](MarkupAnnotation#flags)

***

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`id`](MarkupAnnotation#id)

***

### justification

#### Get Signature

> **get** **justification**(): [`VariableTextJustification`](../enumerations/VariableTextJustification)

Gets or sets the justification to be used in displaying the annotation's text.
See PDF specification for details.

##### Returns

[`VariableTextJustification`](../enumerations/VariableTextJustification)

#### Set Signature

> **set** **justification**(`value`): `void`

Gets or sets the justification to be used in displaying the annotation's text.
See PDF specification for details.

##### Parameters

###### value

[`VariableTextJustification`](../enumerations/VariableTextJustification)

##### Returns

`void`

***

### lineDashPattern

#### Get Signature

> **get** **lineDashPattern**(): `number`[] \| `null`

Gets or sets the line dash pattern. Null means a solid line.

##### Returns

`number`[] \| `null`

#### Set Signature

> **set** **lineDashPattern**(`value`): `void`

Gets or sets the line dash pattern. Null means a solid line.

##### Parameters

###### value

`number`[] | `null`

##### Returns

`void`

***

### lineEndStyle

#### Get Signature

> **get** **lineEndStyle**(): [`LineEndingStyle`](../enumerations/LineEndingStyle)

Gets or sets the style of end callout line.

##### Returns

[`LineEndingStyle`](../enumerations/LineEndingStyle)

#### Set Signature

> **set** **lineEndStyle**(`value`): `void`

Gets or sets the style of end callout line.

##### Parameters

###### value

[`LineEndingStyle`](../enumerations/LineEndingStyle)

##### Returns

`void`

***

### lineWidth

#### Get Signature

> **get** **lineWidth**(): `number`

Gets or sets the line width in points.

##### Returns

`number`

#### Set Signature

> **set** **lineWidth**(`value`): `void`

Gets or sets the line width in points.

##### Parameters

###### value

`number`

##### Returns

`void`

***

### locked

#### Get Signature

> **get** **locked**(): `boolean`

Gets or sets a value indicating whether the annotation can be deleted or its properties (including position and size) can be modified by the user.
However, this flag does not restrict changes to the annotation's contents, such as the value of a form field.

##### Returns

`boolean`

#### Set Signature

> **set** **locked**(`value`): `void`

Gets or sets a value indicating whether the annotation can be deleted or its properties (including position and size) can be modified by the user.
However, this flag does not restrict changes to the annotation's contents, such as the value of a form field.

##### Parameters

###### value

`boolean`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`locked`](MarkupAnnotation#locked)

***

### lockedContents

#### Get Signature

> **get** **lockedContents**(): `boolean`

Gets or sets a value indicating whether the contents of the annotation can be modified by the user.
This flag does not restrict deletion of the annotation or changes to other annotation properties,
such as position and size.

##### Returns

`boolean`

#### Set Signature

> **set** **lockedContents**(`value`): `void`

Gets or sets a value indicating whether the contents of the annotation can be modified by the user.
This flag does not restrict deletion of the annotation or changes to other annotation properties,
such as position and size.

##### Parameters

###### value

`boolean`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`lockedContents`](MarkupAnnotation#lockedcontents)

***

### modifiedDate

#### Get Signature

> **get** **modifiedDate**(): [`PdfDateTime`](../type-aliases/PdfDateTime) \| `null`

Gets or sets the date and time when the annotation was modified.

##### Returns

[`PdfDateTime`](../type-aliases/PdfDateTime) \| `null`

#### Set Signature

> **set** **modifiedDate**(`value`): `void`

Gets or sets the date and time when the annotation was modified.

##### Parameters

###### value

[`PdfDateTime`](../type-aliases/PdfDateTime) | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`modifiedDate`](MarkupAnnotation#modifieddate)

***

### name

#### Get Signature

> **get** **name**(): `string` \| `null`

Gets or sets the annotation name, a text string uniquely identifying it among all annotations on its page.

##### Returns

`string` \| `null`

#### Set Signature

> **set** **name**(`value`): `void`

Gets or sets the annotation name, a text string uniquely identifying it among all annotations on its page.

##### Parameters

###### value

`string` | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`name`](MarkupAnnotation#name)

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`om`](MarkupAnnotation#om)

***

### opacity

#### Get Signature

> **get** **opacity**(): `number`

Gets or sets the opacity value to be used in painting the annotation.
This value applies 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.

##### Returns

`number`

#### Set Signature

> **set** **opacity**(`value`): `void`

Gets or sets the opacity value to be used in painting the annotation.
This value applies 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.

##### Parameters

###### value

`number`

##### Returns

`void`

#### Overrides

[`MarkupAnnotation`](MarkupAnnotation).[`opacity`](MarkupAnnotation#opacity)

***

### page

#### Get Signature

> **get** **page**(): [`PdfPage`](PdfPage) \| `null`

Gets or sets the [PdfPage](PdfPage) that contains this annotation.
Note that an annotation may be referenced by several pages.
In that case this property returns the first element in the 
[pages](AnnotationBase#pages) collection.
When setting this property, the following applies:
If the new value is null, this annotation is removed from all pages.
Otherwise, this annotation is assigned exclusively to the specified page.

##### Returns

[`PdfPage`](PdfPage) \| `null`

#### Set Signature

> **set** **page**(`value`): `void`

Gets or sets the [PdfPage](PdfPage) that contains this annotation.
Note that an annotation may be referenced by several pages.
In that case this property returns the first element in the 
[pages](AnnotationBase#pages) collection.
When setting this property, the following applies:
If the new value is null, this annotation is removed from all pages.
Otherwise, this annotation is assigned exclusively to the specified page.

##### Parameters

###### value

[`PdfPage`](PdfPage) | `null`

##### Returns

`void`

#### Inherited from

[`UnknownAnnotation`](UnknownAnnotation).[`page`](UnknownAnnotation#page)

***

### pages

#### Get Signature

> **get** **pages**(): [`AnnotationPagesCollection`](AnnotationPagesCollection)

Gets the list of pages that reference this annotation.

##### Returns

[`AnnotationPagesCollection`](AnnotationPagesCollection)

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`pages`](MarkupAnnotation#pages)

***

### pdfCalloutLine

#### Get Signature

> **get** **pdfCalloutLine**(): [`Point`](../type-aliases/Point)[] \| `null`

Gets or sets an array of 2 or 3 [Point](../type-aliases/Point) structures specifying a callout line attached to the free text annotation.
3 points represent the starting coordinates, the knee point, and the ending coordinates of the line.
2 points represent the starting and ending coordinates of the line.
The coordinates are specified in PDF user space.
The positive X axis extends horizontally to the right, and the positive Y axis
extends vertically upward, with the origin usually in the lower left corner of the page.

##### Returns

[`Point`](../type-aliases/Point)[] \| `null`

#### Set Signature

> **set** **pdfCalloutLine**(`value`): `void`

Gets or sets an array of 2 or 3 [Point](../type-aliases/Point) structures specifying a callout line attached to the free text annotation.
3 points represent the starting coordinates, the knee point, and the ending coordinates of the line.
2 points represent the starting and ending coordinates of the line.
The coordinates are specified in PDF user space.
The positive X axis extends horizontally to the right, and the positive Y axis
extends vertically upward, with the origin usually in the lower left corner of the page.

##### Parameters

###### value

[`Point`](../type-aliases/Point)[] | `null`

##### Returns

`void`

***

### pdfRect

#### Get Signature

> **get** **pdfRect**(): [`Rect`](../type-aliases/Rect)

Gets or sets the rectangle that defines the location and size of the annotation on a page
in PDF user space coordinates. 
The positive X axis extends horizontally to the right, and the positive Y axis
extends vertically upward, with the origin usually in the lower left corner of the page.

##### See

[rect](AnnotationBase#rect)

##### Returns

[`Rect`](../type-aliases/Rect)

#### Set Signature

> **set** **pdfRect**(`value`): `void`

Gets or sets the rectangle that defines the location and size of the annotation on a page
in PDF user space coordinates. 
The positive X axis extends horizontally to the right, and the positive Y axis
extends vertically upward, with the origin usually in the lower left corner of the page.

##### See

[rect](AnnotationBase#rect)

##### Parameters

###### value

[`Rect`](../type-aliases/Rect)

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`pdfRect`](MarkupAnnotation#pdfrect)

***

### popup

#### Get Signature

> **get** **popup**(): [`PopupAnnotation`](PopupAnnotation) \| `null`

Gets or sets the [PopupAnnotation](PopupAnnotation) annotation for entering or editing text associated with this annotation.
Setting this property changes the [PopupAnnotation#parent](PopupAnnotation#parent) property.
A separate [PopupAnnotation](PopupAnnotation) allows defining additional properties of 
the popup window: color, position etc.

##### Returns

[`PopupAnnotation`](PopupAnnotation) \| `null`

#### Set Signature

> **set** **popup**(`value`): `void`

Gets or sets the [PopupAnnotation](PopupAnnotation) annotation for entering or editing text associated with this annotation.
Setting this property changes the [PopupAnnotation#parent](PopupAnnotation#parent) property.
A separate [PopupAnnotation](PopupAnnotation) allows defining additional properties of 
the popup window: color, position etc.

##### Parameters

###### value

[`PopupAnnotation`](PopupAnnotation) | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`popup`](MarkupAnnotation#popup)

***

### rect

#### Get Signature

> **get** **rect**(): [`Rect`](../type-aliases/Rect)

Gets or sets the rectangle that defines the location and size of the annotation on a page.
The coordinates of the rectangle are relative to the upper left corner of the page's
media box, with the Y (vertical) coordinates increasing from top to bottom.
Note that if the annotation is associated with more than one page,
the media box of the first of those pages is used to calculate the rectangle's location.

##### Returns

[`Rect`](../type-aliases/Rect)

#### Set Signature

> **set** **rect**(`value`): `void`

Gets or sets the rectangle that defines the location and size of the annotation on a page.
The coordinates of the rectangle are relative to the upper left corner of the page's
media box, with the Y (vertical) coordinates increasing from top to bottom.
Note that if the annotation is associated with more than one page,
the media box of the first of those pages is used to calculate the rectangle's location.

##### Parameters

###### value

[`Rect`](../type-aliases/Rect)

##### Returns

`void`

#### Inherited from

[`UnknownAnnotation`](UnknownAnnotation).[`rect`](UnknownAnnotation#rect)

***

### referenceAnnotation

#### Get Signature

> **get** **referenceAnnotation**(): [`MarkupAnnotation`](MarkupAnnotation) \| `null`

Gets or sets the annotation referenced by this annotation.

##### Returns

[`MarkupAnnotation`](MarkupAnnotation) \| `null`

#### Set Signature

> **set** **referenceAnnotation**(`value`): `void`

Gets or sets the annotation referenced by this annotation.

##### Parameters

###### value

[`MarkupAnnotation`](MarkupAnnotation) | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`referenceAnnotation`](MarkupAnnotation#referenceannotation)

***

### referenceType

#### Get Signature

> **get** **referenceType**(): `string`

Gets or sets the relationship (reference type) between this annotation and the annotation specified by the 'referenceAnnotation' property.
The referenced annotation should be on the same page with the current annotation.
The valid values: "R" (reply), "Group"

##### Returns

`string`

#### Set Signature

> **set** **referenceType**(`value`): `void`

Gets or sets the relationship (reference type) between this annotation and the annotation specified by the 'referenceAnnotation' property.
The referenced annotation should be on the same page with the current annotation.
The valid values: "R" (reply), "Group"

##### Parameters

###### value

[`AnnotationReferenceType`](../type-aliases/AnnotationReferenceType)

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`referenceType`](MarkupAnnotation#referencetype)

***

### richText

#### Get Signature

> **get** **richText**(): `string`

Gets or sets the text to be displayed in the pop-up window when the annotation is opened.
This text can be formatted using HTML tags, see PDF specification for details.

##### Returns

`string`

#### Set Signature

> **set** **richText**(`value`): `void`

Gets or sets the text to be displayed in the pop-up window when the annotation is opened.
This text can be formatted using HTML tags, see PDF specification for details.

##### Parameters

###### value

`string` | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`richText`](MarkupAnnotation#richtext)

***

### subject

#### Get Signature

> **get** **subject**(): `string` \| `null`

Gets or sets the text representing a short description of the subject being addressed by the annotation.

##### Returns

`string` \| `null`

#### Set Signature

> **set** **subject**(`value`): `void`

Gets or sets the text representing a short description of the subject being addressed by the annotation.

##### Parameters

###### value

`string` | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`subject`](MarkupAnnotation#subject)

***

### textOffsets

#### Get Signature

> **get** **textOffsets**(): [`Offsets`](../type-aliases/Offsets) \| `null`

Gets or sets the [Offsets](../type-aliases/Offsets) structure that defines
the numerical differences between two rectangles:
the [AnnotationBase#rect](AnnotationBase#rect) and an inner rectangle contained within that rectangle.
The inner rectangle is where the FreeTextAnnotation's text should be displayed.

Note that if this rectangle is not specified then [AnnotationBase#rect](AnnotationBase#rect)
is used as the text rectangle.

##### Returns

[`Offsets`](../type-aliases/Offsets) \| `null`

#### Set Signature

> **set** **textOffsets**(`value`): `void`

Gets or sets the [Offsets](../type-aliases/Offsets) structure that defines
the numerical differences between two rectangles:
the [AnnotationBase#rect](AnnotationBase#rect) and an inner rectangle contained within that rectangle.
The inner rectangle is where the FreeTextAnnotation's text should be displayed.

Note that if this rectangle is not specified then [AnnotationBase#rect](AnnotationBase#rect)
is used as the text rectangle.

##### Parameters

###### value

[`Offsets`](../type-aliases/Offsets) | `null`

##### Returns

`void`

***

### userName

#### Get Signature

> **get** **userName**(): `string` \| `null`

Gets or sets the text label to be displayed in the title bar of the annotation's pop-up window
when open and active. By convention, this entry identifies the user who added the annotation.

##### Returns

`string` \| `null`

#### Set Signature

> **set** **userName**(`value`): `void`

Gets or sets the text label to be displayed in the title bar of the annotation's pop-up window
when open and active. By convention, this entry identifies the user who added the annotation.

##### Parameters

###### value

`string` | `null`

##### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`userName`](MarkupAnnotation#username)

## Methods

### free()

> **free**(): `void`

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`free`](MarkupAnnotation#free)

***

### rebind()

> **rebind**(`omTo`): `void`

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`rebind`](MarkupAnnotation#rebind)

***

### removeAppearance()

> **removeAppearance**(): `void`

Removes all appearance streams associated with the current annotation,
and disables generation of appearance steams for this annotation when the document is saved.

Note that if any property affecting the annotation's appearance 'rect' is then changed,
the appearance streams will be regenerated. So this method would usually be called after
initializing all annotation's properties.

#### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`removeAppearance`](MarkupAnnotation#removeappearance)

***

### resetAppearance()

> **resetAppearance**(): `void`

Forces regeneration of the annotation's appearance streams
next time the document is saved.

#### Returns

`void`

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`resetAppearance`](MarkupAnnotation#resetappearance)
