Skip to main content
Version: Version 5

Class: AnnotationManager

Class for all annotation related operations.

Constructors

new AnnotationManager()

new AnnotationManager(document): AnnotationManager

Parameters

document: Document

Returns

AnnotationManager

Methods

add()

add(annotation)

add(annotation): Promise<void>

Adds a single annotation to the document.

Parameters

annotation: Annotation

The annotation to be added.

Returns

Promise<void>

add(annotations)

add(annotations): Promise<void>

Adds multiple annotations to the document.

Parameters

annotations: Annotation[]

An array of annotations to be added.

Returns

Promise<void>


bringToBack()

bringToBack(annotation): void

Experimental

Brings the specified annotation to the back, making it appear below other annotations.

Parameters

annotation: Annotation

The annotation to bring to the back.

Returns

void


bringToFront()

bringToFront(annotation): void

Experimental

Brings the specified annotation to the front, making it appear above other annotations.

Parameters

annotation: Annotation

The annotation to bring to the front.

Returns

void


copy()

copy(annotation): void

Experimental

Creates a copy of the specified annotation.

Parameters

annotation: Annotation

The annotation to be copied.

Returns

void


delete()

delete(annotation)

delete(annotation): Promise<void>

Deletes a single annotation from the document.

Parameters

annotation: Annotation

The annotation to be deleted.

Returns

Promise<void>

delete(annotations)

delete(annotations): Promise<void>

Deletes multiple annotations from the document.

Parameters

annotations: Annotation[]

An array of annotations to be deleted.

Returns

Promise<void>

delete(annotationId)

delete(annotationId): Promise<void>

Experimental

Deletes an annotation by its ID from the document.

Parameters

annotationId: string

The ID of the annotation to be deleted.

Returns

Promise<void>


getAll()

getAll(): Promise<Annotation[]>

Retrieves a list of all annotations in the document.

Returns

Promise<Annotation[]>

An array containing all the annotations.


getAllOnPage()

getAllOnPage(pageNumber): Promise<Annotation[]>

Retrieves annotations on a specific page.

Parameters

pageNumber: number

The page number to retrieve annotations from.

Returns

Promise<Annotation[]>

An array containing all the annotations on a specific page.


getById()

getById(annotationId): Annotation

Experimental

Retrieves an annotation by its ID from the document.

Parameters

annotationId: string

The ID of the annotation to retrieve.

Returns

Annotation

The retrieved annotation.


hide()

hide(annotation)

hide(annotation): Promise<void>

Hides the specified annotation, making it invisible within the document.

Parameters

annotation: Annotation

The annotation to be hidden.

Returns

Promise<void>

hide(annotations)

hide(annotations): Promise<void>

Experimental

Hides multiple annotations, making them invisible within the document.

Parameters

annotations: Annotation[]

An array of annotations to be hidden.

Returns

Promise<void>


update()

update(annotation)

update(annotation): Promise<void>

Updates a single annotation in the document.

Parameters

annotation: Annotation

The annotation to be updated.

Returns

Promise<void>

update(annotations)

update(annotations): Promise<void>

Updates multiple annotations in the document.

Parameters

annotations: Annotation[]

An array of annotations to be updated.

Returns

Promise<void>