AnnotationController

Atalasoft.Controls.WebDocumentViewer~ AnnotationController

new AnnotationController()

WebDocumentViewer Annotations API.

Methods

loadSingle(xmpFileName, annotationId, loadCallbackHandleropt)

Loads single annotation by its unique identifier.

Parameters:
Name Type Description
xmpFileName string

file name to load from.

annotationId integer

unique annotation object identifier.

[loadCallbackHandler] NotificationCallback

Function to be called when the operation has completed.

cancelDraw()

Cancels the drawing of an annotation and returns the viewer to the previous tool.

createOnPage(annotationConfig, index) → {AnnotationData}

Creates an annotation on the desired page with the given annotation data.

Parameters:
Name Type Description
annotationConfig AnnotationData

Key value pairs representing annotation data.

index number

The index of the page the annotation should be created on.

Returns:
  • Annotation data.
Type
AnnotationData

deleteFromPage(pageIndex, annIndex)

Deletes an annotation on the given page by it's index on the page.

Parameters:
Name Type Description
pageIndex number

Page index the annotation is located on.

annIndex number

Index of the annotation on the page.

deselectAll()

Deselects all annotations on every page.

deselectAllOnPage(index)

Deselects all annotations on the given page.

Parameters:
Name Type Description
index number

The index of the page the annotations should be deselected on.

drawAnnotation(aConfig, callbackopt, cancelledopt)

Setups the viewport to create an annotation

Parameters:
Name Type Description
aConfig AnnotationData

Configuration for the annotation to draw

[callback] NotificationCallback

function to call when the annotation has finished drawing.

[cancelled] NotificationCallback

function to call when the annotation draw was canceled.

getFromPage(index) → {Array.<AnnotationData>}

Gets an array of annotation data objects located on the given zero based page index.

Parameters:
Name Type Description
index number

The page index the annotations are located on.

Returns:

Annotation data objects on the given page.

Type
Array.<AnnotationData>

getSelected() → {Array.<Array.<AnnotationData>>}

Gets a nested array of selected annotation data objects for each page with annotations. Outer array is pages, inner array is selected annotations.

Returns:
  • Annotation data objects for selected annotations only for each page with annotations.
Type
Array.<Array.<AnnotationData>>

hideEditor(annotation)

Hides the text annotation editor. Applies only to text annotations and ignores other types of annotations.

Parameters:
Name Type Description
annotation AnnotationData

The annotation object to hide editor for.

insertLayer(sourceUrl, layer, index, callbackopt)

Inserts a layer of annotations at the source URL and index into the given page index. Single layer of annotations corresponds to single document page.

Parameters:
Name Type Description
sourceUrl string

Reserved for future use.

layer Array.<AnnotationData>

The annotation layer data.

index number

Index the layer is to be inserted into.

[callback] NotificationCallback

Function to be called when the operation has completed.

isAnnotationsPropertiesWindowShown() → {boolean}

Indicates whether annotations properties window is shown.

Returns:
Type
boolean

load(xmpFileName, fIndex, countopt, loadCallbackHandleropt)

Loads annotations from specified document pages.

Parameters:
Name Type Description
xmpFileName string

file name to load from.

fIndex integer

null-based page index to load annotations from.

[count] integer

count of pages starting from fIndex.

[loadCallbackHandler] NotificationCallback

Function to be called when the operation has completed.

loadAll(xmpFileName, loadCallbackHandleropt)

Loads all annotations from all document pages.

Parameters:
Name Type Description
xmpFileName string

file name to load from.

[loadCallbackHandler] NotificationCallback

Function to be called when the operation has completed.

changeTabIndex(anno, value)

Sets the tab index of the annotation.

Parameters:
Name Type Description
anno AnnotationData

the annotation object to change.

value number

new annotation tab index.

moveLayer(sourceIndex, destIndex, callbackopt)

Moves a layer of annotations from one page index to another.

Parameters:
Name Type Description
sourceIndex number

index of the layer to be moved.

destIndex number

Destination zero based page index.

[callback] NotificationCallback

Function to be called when the operation has completed.

removeLayer(index, callbackopt)

Removes a layer(page annotation) of annotations. All other layers are shifted. This operation corresponds to removing page from the document.

Parameters:
Name Type Description
index number

index of the layer to be removed.

[callback] NotificationCallback

Function to be called when the operation has completed.

save(xmpFileName, fIndex, countopt, saveCallbackHandleropt)

Saves annotations from specified document pages.

Parameters:
Name Type Description
xmpFileName string

file name to save to.

fIndex integer

null-based page index to save annotations from.

[count] integer

count of pages starting from fIndex.

[saveCallbackHandler] NotificationCallback

Function to be called when the operation has completed.

saveAll(xmpFileName, saveCallbackHandleropt)

Saves all annotations from all document pages.

Parameters:
Name Type Description
xmpFileName string

file name to save to.

[saveCallbackHandler] NotificationCallback

Function to be called when the operation has completed.

saveSingle(xmpFileName, annotationId, saveCallbackHandleropt)

Saves single annotation by its unique identifier.

Parameters:
Name Type Description
xmpFileName string

file name to save to.

annotationId integer

unique annotation object identifier.

[saveCallbackHandler] NotificationCallback

Function to be called when the operation has completed.

scrollTo(anno, callbackopt)

Scrolls viewer to the specified annotation.

Parameters:
Name Type Description
anno AnnotationData

the annotation object to scroll to.

[callback] NotificationCallback

Function to be called when the operation has completed.

selectAll()

Selects all annotations on every page.

selectAllOnPage(index)

Selects all annotations on the given page.

Parameters:
Name Type Description
index number

The index of the page the annotations should be selected on.

setDefaults(aConfig) → {Atalasoft.Controls.WebDocumentViewer}

Sets the default annotation properties for initially created annotations. This accepts the same input as the config.annotations.defaults.

Parameters:
Name Type Description
aConfig Array.<AnnotationData>

Default configurations for different types of the annotations.

Returns:
Type
WebDocumentViewer

setImages(aConfig) → {Atalasoft.Controls.WebDocumentViewer}

Sets the default annotation properties for image annotations. This accepts the same input as the config.annotations.images

Parameters:
Name Type Description
aConfig Array.<AnnotationData>

Default configurations image annotations.

Returns:
Type
WebDocumentViewer

setStamps(aConfig) → {Atalasoft.Controls.WebDocumentViewer}

Sets the default annotation properties for stamp annotations. This accepts the same input as the config.annotations.stamps.

Parameters:
Name Type Description
aConfig Array.<AnnotationData>

Default configurations stamp annotations.

Returns:
Type
WebDocumentViewer

showAnnotationsPropertiesWindow()

Shows annotation properties window for selected annotation.

showEditor(annotation)

Shows the editor dialog for text annotations. Ignores other types of annotations.

Parameters:
Name Type Description
annotation AnnotationData

the annotation object to show editor for.

Annotation object should be retrieved using corresponding API. If it's constructed by the application, annotation won't be matched.

Events

annotationchanged :AnnotationCallback

Triggers when an annotation has been changed.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annobefore AnnotationData

Annotation object before the changes were applied.

annotationclicked :AnnotationCallback

Triggers when the user uses the mouse to click on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationcreated :AnnotationCallback

This event is triggered when annotation is created, whether through mouse/touch events or programmatically.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

page number

event.Index of the page where annotation is created.

event.anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationdeleted

Triggers when an annotation is deleted.

Parameters:
Name Type Description
event Object

Event arguments.

Properties
Name Type Description
page number

Index of the page where annotation has been removed.

index number

Index at which annotation has been removed.

annotationdeselected :AnnotationCallback

Triggers when an annotation is deselected.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

annotationdoubleclicked :AnnotationCallback

Triggers when the user uses the mouse to double-click on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationdragend :AnnotationCallback

Triggers when an annotation has finished dragging.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

ann AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationdragstart :AnnotationCallback

Triggers when an annotation has started dragging.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

ann AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationdrawend :AnnotationCallback

Triggers when a user has finished drawing an annotation with the mouse or a touch event.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

cancelled boolean

Indicates whether annotation draw was cancelled.

ann AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationdrawstart :AnnotationCallback

Triggers when a user has started drawing an annotation with the mouse or a touch event.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

ann AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationloaded :AnnotationCallback

Triggers when an annotation is loaded into the document. There are multiple ways how annotations could be loaded, for example passing the annotationsurl in the constructor, or by calling viewer.openUrl. In this case event will be fired for each loaded annotation from all layers.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

customData Object

The event customer data from server.

annotationmousedown :AnnotationCallback

Triggers when the user has depressed a mouse button on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationmousedownleft :AnnotationCallback

Triggers when the user has depressed the left mouse button on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationmousedownright :AnnotationCallback

Triggers when the user has depressed the right mouse button on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationmousemove :AnnotationCallback

Triggers when the user moves the mouse pointer over an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationmouseout :AnnotationCallback

Triggers when the user has moved the mouse pointer out of the bounds of the annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationmouseover :AnnotationCallback

Triggers when the user has moved the mouse pointer into the bounds of the annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationmouseup :AnnotationCallback

Triggers when the user has released a mouse button on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationmoved :AnnotationCallback

Triggers when an annotation has been moved.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationpinchresize :AnnotationCallback

Triggers when a pinch gesture has been detected on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationrepainted :AnnotationCallback

Triggers when an annotation has been repainted.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationresized :AnnotationCallback

Triggers when an annotation has been resized.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationrightclicked :AnnotationCallback

Triggers when the user right clicks on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationrotated :AnnotationCallback

Triggers when an annotation has been rotated.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationscleared

Triggers when all annotations have been deleted.

annotationselected :AnnotationCallback

Triggers when an annotation is selected.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

annotationsloaded :AnnotationCallback

Triggers when all annotations are loaded into the document. There are multiple ways how annotations could be loaded, for example passing the annotationsurl in the constructor, or by calling viewer.openUrl. In this case event will be fired for each loaded annotation from all layers.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
customData Object

The event customer data from server.

annotationspropertieswindowopened :AnnotationCallback

Triggers when the user opens annotation properties window.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

annotationtextchanged :AnnotationCallback

Triggers when user finishes text edit for Text annotation and Text annotation edit mode is switched off.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationtouchend :AnnotationCallback

Triggers when a touch end event has been finished on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationtouchmove :AnnotationCallback

Triggers when a touch move event is happening on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

annotationtouchstart :AnnotationCallback

Triggers when a touch event has started on an annotation.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
annotation AnnotationData

Annotation object related to the event.

anno AnnotationData

Deprecated. Please use annotation property. This property will be removed soon.

contextmenu :AnnotationContextMenuCallback

Triggers when the context menu is shown for an annotation.

Parameters:
Name Type Description
event Object

Event data object.

annotation AnnotationData

The data of the annotation which context menu were activated.

menu AnnotationContextMenu

The menu configuration. Keys of this object is treated as menu titles and values under those keys are handler functions. This object could be modified by application to extend or modify current menu instance.

layerinserted

Triggers when a layer has been inserted into the document.

Parameters:
Name Type Description
event Object

Event data object.

Properties
Name Type Description
index number

Index of the inserted layer.

layermoved

Triggers when a layer has moved from one index to another within the document.

Parameters:
Name Type Description
event Object

Event arguments.

Properties
Name Type Description
srcindex number

Index from which layer was moved.

destindex number

Index of the moved layer.

layerremoved

Triggers when a layer has been removed from the document.

Parameters:
Name Type Description
event Object

Event arguments.

Properties
Name Type Description
index number

Index from which layer was removed.

layer Array.<AnnotationData>

The removed layer data.

layerschanged :NotificationCallback

Triggers when a layer has been changed. Fired by any type of layers structure: insertLayer, moveLayer or removeLayer.

raphaelloaded

Triggers when the Raphael dependency has finished loading.

Deprecated:
  • WDV doesn't try to load any dependencies by its own. You need to add all necessary scripts to page's head section manually.