Represents generic annotation data object.

This basic object structure is applied to all annotations. Individual types of annotation could ignored some of those properties. This structure is used when configuring default values for particular annotation types using WebDocumentViewerConfig.annotations, creating annotations using annotations.createOnPage or retrieving annotations data using corresponding api.

Note, Annotation could have only one of two positioning models

  • Box model, i.e. annotation position and size is defined by X, Y, width and height properties. For example, rectangle or text annotations.

  • Points model, which means that annotation consist of an array of individual points stored in points property. For example, lines or freehand annotations.

It's expected that annotation have only one of positioning model, and often rendering is performed basing on existence or absence of points value. I.e. in case if points is set, X, Y, width and height values could be ignored.

Name Type Default Description
name string

Annotation type title. This will be shown as a caption for toolbar buttons representing "extended" types annotations. This applies to stamp and image types of annotation. I.e. name should be set to annotations defined by application using annotations.stamps and annotations.images.

type AnnotationTypes

Annotation type.

[rotation] number 0

Represents annotation rotation angle.

Note, this property is ignored when annotation is created from UI, i.e. when specified in WebDocumentViewerConfig.annotations configurations.

[burn] boolean false

Indicates whether this annotation should be "burned" to output document on save. If set to true, annotation will be rendered on top of the image for all output formats except PDF. For PDF documents, annotations will be rendered and added as a separate layer on top of the document content.

[extra] Object

Additional data that could be stored along with annotation. Application specific properties is expected to be inserted into this object. Those data will be transacted to extra properties of the server-side AnnotationData object.

[fill] AnnotationFill

Represents annotation fill.

[height] number 0

Height of the annotation box.

[movable] boolean true

Indicates whether annotation could be moved through UI.

[outline] AnnotationOutline

Annotation outline.

[points] Array.<Point>

Array of annotation points.

[readonly] boolean false

Indicates whether annotation is readonly. If set to true annotation couldn't be modified through UI and context menu couldn't be shown for it.

[resizable] boolean true

Indicates whether annotation could be resized through UI.

[rotatable] boolean true

Indicates whether annotation could be rotated through UI.

[cornerradius] number 0

Represents corner rounding radius for Stamp annotations.

[selectable] boolean true

Indicates whether annotation is selectable.

[selected] boolean false

Indicates whether annotation is currently selected.

[src] string

Url of the image displayed by the "image" annotation.

[text] AnnotationTextConfig

Annotation text configuration.

[tooltip] string

Annotation tooltip.

[username] string

Corresponds to server side AnnotationData.UserName property.

[visible] boolean true

Indicates whether annotation is visible.

[width] number 0

Width of the annotation box.

[x] number 0

X axis annotation coordinate in document coordinate space.

[y] number 0

Y axis annotation coordinate in document coordinate space.


getPageIndex() → {number}

Returns the page index for particular annotation.



Synchronizes user instance of the annotation data with corresponding internal state. Triggers UI invalidation if necessary.

This method should be called to apply any property changes made by application.