# TextAnnotation

## Content

# Class: TextAnnotation

Text annotation.

## Extends

- [`MarkupAnnotation`](MarkupAnnotation)

## Properties

### annotationName

```ts
annotationName: string;
```

Annotation name (NM entry).

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`annotationName`](MarkupAnnotation#annotationname)

***

### annotationType

```ts
annotationType: AnnotationTypeCode;
```

Annotation type.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`annotationType`](MarkupAnnotation#annotationtype)

***

### appearanceColor?

```ts
optional appearanceColor: string;
```

Appearance color.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`appearanceColor`](MarkupAnnotation#appearancecolor)

***

### borderStyle?

```ts
optional borderStyle: object;
```

Annotation's border style.

#### dashArray?

```ts
optional dashArray: number[];
```

Border dash pattern. Used when the border style is dashed.

#### horizontalCornerRadius

```ts
horizontalCornerRadius: number;
```

#### style

```ts
style: number;
```

Border style. Possible values: 1 - solid style (default), 2 - dashed style.

#### verticalCornerRadius

```ts
verticalCornerRadius: number;
```

#### width

```ts
width: number;
```

Border width.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`borderStyle`](MarkupAnnotation#borderstyle)

***

### color?

```ts
optional color: string;
```

Annotation color.

#### Inherited from

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

***

### contents?

```ts
optional contents: string;
```

The text (or rich text) string that shall be displayed in the pop-up when the annotation is opened.

#### Inherited from

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

***

### convertToContent?

```ts
optional convertToContent: boolean;
```

Indicates whether the annotation will be converted to content when the document is saved.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`convertToContent`](MarkupAnnotation#converttocontent)

***

### creationDate

```ts
creationDate: string;
```

Creation date.

#### Inherited from

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

***

### display?

```ts
optional display: "hidden" | "visible";
```

The field is used for compatibility with Adobe Acrobat Reader.

#### Inherited from

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

***

### displayState

```ts
displayState: 
  | AnnotationMarkedStateType
  | AnnotationReviewStateType;
```

Internal helper property.
The State to which original annotation is set by current user.

***

### hasPopup

```ts
hasPopup: boolean;
```

Indicates if annotation has associated popup annotation.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`hasPopup`](MarkupAnnotation#haspopup)

***

### id

```ts
id: string;
```

Annotation id.

#### Inherited from

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

***

### invisibleFlag

```ts
invisibleFlag: boolean;
```

true if the annotation is hidden.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`invisibleFlag`](MarkupAnnotation#invisibleflag)

***

### irtAnnotations?

```ts
optional irtAnnotations: AnnotationBase[];
```

Internal helper property.
Primary annotation's children annotations.
Note, the array contains all children annotations, including annotations what is not direct descendant of the primary annotation.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`irtAnnotations`](MarkupAnnotation#irtannotations)

***

### isRichContents

```ts
isRichContents: boolean;
```

Specifies whether or not the RichContent mode is used for the contents property.

#### Overrides

[`MarkupAnnotation`](MarkupAnnotation).[`isRichContents`](MarkupAnnotation#isrichcontents)

***

### locked

```ts
locked: boolean;
```

Specifies whether the annotation can be deleted or its properties (including position and size) can be modified by the user.

#### Example

```javascript
var viewer = new DsPdfViewer('#root', { renderInteractiveForms: true , supportApi: { apiUrl: 'api/pdf-viewer', webSocketUrl: false } });
viewer.addDefaultPanels();
viewer.addAnnotationEditorPanel();
viewer.addFormEditorPanel();
viewer.addReplyTool();
viewer.onAfterOpen.register(()=>{
	// Lock all text annotations after document open:
	const resultArr = await viewer.findAnnotation(1, // 1 - AnnotationTypeCode.TEXT
						  { findField: 'annotationType',
				  		    pageNumberConstraint: 1, findAll: true });
	viewer.updateAnnotations(0, resultArr.map((data)=> { data.annotation.locked = true; return data.annotation; }));
});
// Open Annotations.pdf
viewer.open('Annotations.pdf');
```

#### Inherited from

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

***

### modificationDate

```ts
modificationDate: string;
```

Modification date.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`modificationDate`](MarkupAnnotation#modificationdate)

***

### name

```ts
name: 
  | "Comment"
  | "Key"
  | "Note"
  | "Help"
  | "NewParagraph"
  | "Paragraph"
  | "Insert";
```

Icon name.

#### Default

```ts
'Comment'
```

***

### opacity?

```ts
optional opacity: number;
```

Annotation opacity.

#### Inherited from

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

***

### open

```ts
open: boolean;
```

Initially opened state.

***

### orderIndex

```ts
orderIndex: number;
```

The field order index.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`orderIndex`](MarkupAnnotation#orderindex)

***

### parentAnnotation?

```ts
optional parentAnnotation: AnnotationBase;
```

Resolved reference to parent annotation.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`parentAnnotation`](MarkupAnnotation#parentannotation)

***

### parentId?

```ts
optional parentId: string;
```

Parent annotation id for popup annotation.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`parentId`](MarkupAnnotation#parentid)

***

### popupId

```ts
popupId: string;
```

Popup annotation identifier.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`popupId`](MarkupAnnotation#popupid)

***

### printableFlag

```ts
printableFlag: boolean;
```

Specifies whether or not the annotation can be printed.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`printableFlag`](MarkupAnnotation#printableflag)

***

### rect

```ts
rect: number[];
```

The annotation's bounds rectangle: [x1, y1, x2, y2].
(0, 0) is the bottom left corner of the page.

#### Inherited from

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

***

### redacted

```ts
redacted: boolean;
```

Indicates whether the current annotation has been redacted.
Redacted annotations will be removed from the document after saving.

#### Inherited from

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

***

### redactedBy

```ts
redactedBy: string;
```

ID of the Redact annotation that was used to redact the current annotation.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`redactedBy`](MarkupAnnotation#redactedby)

***

### referenceAnnotationId

```ts
referenceAnnotationId: string;
```

Id of the primary annotation to which this annotation belongs. ("in reply to" value).

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`referenceAnnotationId`](MarkupAnnotation#referenceannotationid)

***

### referenceType

```ts
referenceType: "R" | "Group";
```

R - this annotation is reply to the primary annotation specified by field referenceAnnotationId.
Group - annotation should be grouped with primary annotation specified by field referenceAnnotationId.

#### Inherited from

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

***

### rotate?

```ts
optional rotate: number;
```

The number of degrees by which the annotation shall be rotated relative to the page.

#### Inherited from

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

***

### sharedChanges?

```ts
optional sharedChanges: object;
```

Hash object with information about users who change this annotation.
key - user name
value - UNIX UTC timestamp when changes were added.

#### Index Signature

```ts
[userName: string]: number
```

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`sharedChanges`](MarkupAnnotation#sharedchanges)

***

### state?

```ts
optional state: 
  | AnnotationMarkedStateType
  | AnnotationReviewStateType;
```

The State to which original annotation should be set.

#### Overrides

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

***

### stateModel?

```ts
optional stateModel: AnnotationStateModel;
```

The sateModel corresponding to State.

#### Overrides

[`MarkupAnnotation`](MarkupAnnotation).[`stateModel`](MarkupAnnotation#statemodel)

***

### subject

```ts
subject: string;
```

Text representing a short description of the subject being addressed by the annotation.
The 'subject' is the meta information property and it can be used to group,
sort or filter annotations.

#### Inherited from

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

***

### subtype

```ts
subtype: AnnotationTypeName;
```

Annotation sub-type. Possible values are: 'Text', 'Link', 'FreeText', 'Line', 'Square', 'Circle', 'Polygon', 'PolyLine',
'Highlight', 'Underline', 'Squiggly', 'Strikeout', 'Stamp', 'Caret', 'Ink', 'Popup', 'FileAttachment',
'Sound', 'Movie', 'Widget', 'Screen', 'PrinterMark', 'TrapNet', 'WaterMark',
'Redact', 'Signature', 'ThreadBead', 'RadioButton', 'Checkbox', 'PushButton', 'Choice', 'TextWidget',
'RichMedia'

#### Inherited from

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

***

### textAlignment

```ts
textAlignment: TextAlignmentType;
```

The alignment of the text.

#### Inherited from

[`MarkupAnnotation`](MarkupAnnotation).[`textAlignment`](MarkupAnnotation#textalignment)

***

### title

```ts
title: string;
```

The text label that shall be displayed in the title bar of
the annotation's popup when open and active. This entry shall identify
the user who added the annotation.

#### Inherited from

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