AnnotationData

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.

Properties:
Name Type Default Description
number

unique annotation identifier

number

frame index where annotation is located

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.

[rotatable] boolean true

Indicates whether annotation could be rotated through UI.

[cornerradius] number 0

Represents corner rounding radius for Stamp annotations.

[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 enable for it. (There is a separate readonly property (annotation.text.readonly) for text area in text annotation.)

[resizable] boolean true

Indicates whether annotation could be resized through UI.

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

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

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

[tabindex] number 0

Represents the tab index of the annotation which specifies the tab order. Annotation with lower index gets focus first.

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

Methods

getPageIndex() → {number}

Returns the page index for particular annotation.

Returns:
Type
number

update()

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.