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
|
annotationclicked :AnnotationCallback
Triggers when the user uses the mouse to click on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
||||||
page |
number | event.Index of the page where annotation is created. |
||||||
event.anno |
AnnotationData | Deprecated. Please use |
annotationdeleted
Triggers when an annotation is deleted.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event arguments. Properties
|
annotationdeselected :AnnotationCallback
Triggers when an annotation is deselected.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
annotationdragend :AnnotationCallback
Triggers when an annotation has finished dragging.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationdragstart :AnnotationCallback
Triggers when an annotation has started dragging.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
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
|
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
|
annotationmousedown :AnnotationCallback
Triggers when the user has depressed a mouse button on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
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
|
annotationmousemove :AnnotationCallback
Triggers when the user moves the mouse pointer over an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
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
|
annotationmouseup :AnnotationCallback
Triggers when the user has released a mouse button on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationmoved :AnnotationCallback
Triggers when an annotation has been moved.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationpinchresize :AnnotationCallback
Triggers when a pinch gesture has been detected on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationrepainted :AnnotationCallback
Triggers when an annotation has been repainted.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationresized :AnnotationCallback
Triggers when an annotation has been resized.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationrightclicked :AnnotationCallback
Triggers when the user right clicks on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationrotated :AnnotationCallback
Triggers when an annotation has been rotated.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
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
|
annotationspropertieswindowopened :AnnotationCallback
Triggers when the user opens annotation properties window.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
annotationtouchend :AnnotationCallback
Triggers when a touch end event has been finished on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationtouchmove :AnnotationCallback
Triggers when a touch move event is happening on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
annotationtouchstart :AnnotationCallback
Triggers when a touch event has started on an annotation.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event data object. Properties
|
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
|
layermoved
Triggers when a layer has moved from one index to another within the document.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event arguments. Properties
|
layerremoved
Triggers when a layer has been removed from the document.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | Event arguments. Properties
|
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.