Class
Dynamsoft Document Viewer JavaScript library has two main categories of classes: one is under the namespace Dynamsoft.DDV, and the other is related to annotations.
Dynamsoft.DDV Classes
Under the namespace Dynamsoft.DDV, Dynamsoft Document Viewer JavaScript library contains seven primary classes:
- DocumentManager
- AnnotationManager
- EditViewer
- CaptureViewer
- PerspectiveViewer
- BrowseViewer
- CustomViewer
DocumentManager Class
The Dynamsoft.DDV.documentManager
instance will be created automatically as soon as DDV is initialized. Please refer to documentManager
.
Methods
API Name | Description |
---|---|
createDocument() |
Create an empty document. |
deleteDocuments() |
Delete the specified document(s) by the document uid(s). |
deleteAllDocuments() |
Delete all documents. |
getDocument() |
Get the specified document object with the document uid. |
getAllDocuments() |
Get all documents’ objects. |
mergeDocuments() |
Merge specified documents to a new document. |
copyPagesToDocument() |
Copy pages from a specified document to another document. |
movePagesToDocument() |
Move pages from a specified document to another document. |
Events
API Name | Description |
---|---|
on() |
Bind a listener to the specified event. |
off() |
Unbind event listener(s) from the specified event. |
Integrated Events
Event Name | Description |
---|---|
documentCreated |
Triggered when a new document is created. |
documentDeleted |
Triggered when a document is deleted. |
AnnotationManager Class
The Dynamsoft.DDV.annotationManager
instance will be created automatically as soon as DDV is initialized. Please refer to annotationManager
.
Methods
API Name | Description |
---|---|
createAnnotation() |
Create an annotation instance. |
getAnnotationsByUids() |
Get annotations by annotation uids. |
getAnnotationsByPage() |
Get annotations in specified page. |
getAnnotationsByDoc() |
Get all annotations in specified document. |
deleteAnnotations() |
Delete specified annotations. |
bringAnnotationForward() |
Bring the specified annotation forward. |
sendAnnotationBackward() |
Send the specified annotation backward. |
bringAnnotationToFront() |
Bring the specified annotation in front of all other annotations. |
sendAnnotationToBack() |
Send the specified annotation behind all other annotations. |
Events
API Name | Description |
---|---|
on() |
Bind a listener to the specified event. |
off() |
Unbind event listener(s) from the specified event. |
Integrated Events
Event Name | Description |
---|---|
annotationsAdded |
Triggered when new annotation(s) is added. |
annotationsDeleted |
Triggered when annotation(s) is deleted. |
annotationLayerChanged |
Triggered when annotation’s layer is changed. |
annotationsModified |
Triggered when annotation(s) is modified. |
EditViewer Class
Create and Destroy Instances
API Name | Description |
---|---|
EditViewer() |
Default constructor of an EditViewer instance. |
destroy() |
Destroy the EditViewer instance. |
Viewer Control
API Name | Description |
---|---|
bindContainer() |
Bind the viewer to the specified container. |
unbindContainer() |
Unbind the viewer from the specified container. |
isBoundContainer |
Return whether the viewer is bound to a container. |
getStyle() |
Get the style object of EditViewer . |
updateStyle() |
Update the style object of EditViewer . |
getUiConfig() |
Get current UiConfig object. |
updateUiConfig() |
Update UiConfig object. |
show() |
Show the viewer. |
hide() |
Hide the viewer. |
isVisible |
Return whether the viewer is shown or hidden. |
toolMode |
Specify or return the tool mode of the viewer. |
Document and Page Control
API Name | Description |
---|---|
openDocument() |
Open the specified document by document uid. |
closeDocument() |
Close current document. |
currentDocument |
Return the object of the current document. |
getPageCount() |
Get the page count in the viewer. |
goToPage() |
Navigate to the specified page by index. |
getCurrentPageIndex() |
Get the index of current page. |
getCurrentPageUid() |
Get the uid of the current page. |
indexToUid() |
Get the uid of the specified page by its index. |
uidToIndex() |
Get the index of the specified page by its uid. |
Display Control
API Name | Description |
---|---|
displayMode |
Specify or return the display mode of the viewer. |
setParallelScrollCount() |
Specify the number of pages to scroll in parallel. |
fitMode |
Specify or return the fit mode of the viewer. |
zoom |
Specify or return zoom ratio. |
zoomOrigin |
Specify or return the zoom origin of the viewer. |
Annotation Control
API Name | Description |
---|---|
selectAnnotations() |
Select the specified annotation(s) on the current page. |
getSelectedAnnotations() |
Get selected annotation(s). |
Edit Operations
API Name | Description |
---|---|
rotate() |
Rotate the specified pages. |
crop() |
Crop the specified page(s) with the specified rectangle. |
getCropRect() |
Get the crop rectangular selection. |
setCropRect() |
Set a crop rectangular selection on the current page. This method is only available when toolMode is crop mode. |
undo() |
Undo the last editing operation. |
redo() |
Redo the last undo operation. |
saveOperations() |
Save the edit operations in pages to document. |
Events
API Name | Description |
---|---|
on() |
Bind a listener to the specified event. |
off() |
Unbind event listener(s) from the specified event. |
Integrated Events
Event Name | Description |
---|---|
resized |
Triggered when the viewer is resized. |
pageRendered |
Triggered when a page has been completely rendered. |
currentIndexChanged |
Triggered when currentIndex is changed. |
currentPageChanged |
Triggered when current page is changed. |
displayModeChanged |
Triggered when the display mode is changed. |
fitModeChanged |
Triggered when the fit mode has changed. |
zoomChanged |
Triggered when the zoom ratio has been changed. |
toolModeChanged |
Triggered when the tool mode has changed. |
cropRectDrawn |
Triggered when a rectangular selection is drawn. |
cropRectDeleted |
Triggered when the rectangular selection is deleted. |
cropRectModified |
Triggered when the crop rectangular selection is modified. |
selectedAnnotationsChanged |
Triggered when selected annotation(s) is changed. |
click |
Triggered when click in the viewer’s viewing area. |
dblclick |
Triggered when double click in the viewer’s viewing area. |
rightclick |
Triggered when right click in the viewer’s viewing area. |
CaptureViewer Class
Create and Destroy Instances
API Name | Description |
---|---|
CaptureViewer() |
Default constructor of a CaptureViewer instance. |
destroy() |
Destroy the CaptureViewer instance. |
Viewer Control
API Name | Description |
---|---|
bindContainer() |
Bind the viewer to the specified container. |
unbindContainer() |
Unbind the viewer from the specified container. |
isBoundContainer |
Return whether the viewer is bound to a container. |
getStyle() |
Get the style object of CaptureViewer . |
updateStyle() |
Update the style object of CaptureViewer . |
getUiConfig() |
Get current UiConfig object. |
updateUiConfig() |
Update UiConfig object. |
show() |
Show the viewer. |
hide() |
Hide the viewer. |
isVisible |
Return whether the viewer is shown or hidden. |
Document Control
API Name | Description |
---|---|
openDocument() |
Open the specified document by document uid. |
closeDocument() |
Close current document. |
currentDocument |
Return the object of the current document. |
Camera Control
API Name | Description |
---|---|
play() |
Play the camera video stream. |
stop() |
Stop the camera video stream. |
capture() |
Capture a frame from video stream. |
getAllCameras() |
Return information of all available cameras on the device. |
selectCamera() |
Select a camera as the video source. |
getCurrentCamera() |
Return information about the current camera. |
getCurrentResolution() |
Return the resolution of the current video input. |
turnOnTorch() |
Turn on the torch/flashlight if the current camera supports it. |
turnOffTorch() |
Turn off the torch/flashlight. |
enableAutoCapture |
Specify or return whether to enable automatic capture. |
enableAutoDetect |
Specify or return whether to enable automatic border detection in video stream. |
acceptedPolygonConfidence |
Specify or return the confidence when detecting the border. |
maxFrameNumber |
Specify or return the maximum number of frames detected per second. |
Events
API Name | Description |
---|---|
on() |
Bind a listener to the specified event. |
off() |
Unbind event listener(s) from the specified event. |
Integrated Events
Event Name | Description |
---|---|
resized |
Triggered when the viewer is resized. |
played |
Triggered when the camera video stream is played. |
stopped |
Triggered when the camera video stream is stopped. |
captured |
Triggered when a frame is captured. |
cameraChanged |
Triggered when the used camera is changed. |
click |
Triggered when click in the viewer’s viewing area. |
dblclick |
Triggered when double click in the viewer’s viewing area. |
rightclick |
Triggered when right click in the viewer’s viewing area. |
PerspectiveViewer Class
Create and Destroy Instances
API Name | Description |
---|---|
PerspectiveViewer() |
Default constructor of a PerspectiveViewer instance. |
destroy() |
Destroy the PerspectiveViewer instance. |
Viewer Control
API Name | Description |
---|---|
bindContainer() |
Bind the viewer to the specified container. |
unbindContainer() |
Unbind the viewer from the specified container. |
isBoundContainer |
Return whether the viewer is bound to a container. |
getStyle() |
Get the style object of PerspectiveViewer . |
updateStyle() |
Update the style object of PerspectiveViewer . |
getUiConfig() |
Get current UiConfig object. |
updateUiConfig() |
Update UiConfig object. |
show() |
Show the viewer. |
hide() |
Hide the viewer. |
isVisible |
Return whether the viewer is shown or hidden. |
Document and Page Control
API Name | Description |
---|---|
openDocument() |
Open the specified document by document uid. |
closeDocument() |
Close current document. |
currentDocument |
Return the object of the current document. |
getPageCount() |
Get the page count in the viewer. |
goToPage() |
Navigate to the specified page by index. |
getCurrentPageIndex() |
Get the index of current page. |
getCurrentPageUid() |
Get the uid of the current page. |
indexToUid() |
Get the uid of the specified page by its index. |
uidToIndex() |
Get the index of the specified page by its uid. |
Perspective Transformation
API Name | Description |
---|---|
setQuadSelection() |
Set a quadrilateral selection on the current page. |
getQuadSelection() |
Get the quadrilateral selection. |
resetQuadSelection() |
Reset the quadrilateral selection to the original one. |
applyPerspective() |
Performs a perspective transformation in current page based on the specified quadrangle. |
Edit Operations
API Name | Description |
---|---|
rotate() |
Rotate the specified pages. |
saveOperations() |
Save the edit operations in pages to document. |
Events
API Name | Description |
---|---|
on() |
Bind a listener to the specified event. |
off() |
Unbind event listener(s) from the specified event. |
Integrated Events
Event Name | Description |
---|---|
resized |
Triggered when the viewer is resized. |
pageRendered |
Triggered when a page has been completely rendered. |
currentIndexChanged |
Triggered when currentIndex is changed. |
currentPageChanged |
Triggered when current page is changed. |
quadModifiedModified |
Triggered when the quadrilateral selection is modified. |
click |
Triggered when click in the viewer’s viewing area. |
dblclick |
Triggered when double click in the viewer’s viewing area. |
rightclick |
Triggered when right click in the viewer’s viewing area. |
BrowseViewer Class
Create and Destroy Instances
API Name | Description |
---|---|
BrowseViewer() |
Default constructor of a BrowseViewer instance. |
destroy() |
Destroy the BrowseViewer instance. |
Viewer Control
API Name | Description |
---|---|
bindContainer() |
Bind the viewer to the specified container. |
unbindContainer() |
Unbind the viewer from the specified container. |
isBoundContainer |
Return whether the viewer is bound to a container. |
getStyle() |
Get the style object of BrowseViewer . |
updateStyle() |
Update the style object of BrowseViewer . |
getUiConfig() |
Get current UiConfig object. |
updateUiConfig() |
Update UiConfig object. |
show() |
Show the viewer. |
hide() |
Hide the viewer. |
isVisible |
Return whether the viewer is shown or hidden. |
multiselectMode |
Specify or return whether to allow multiple pages to be selected at once. |
Document and Page Control
API Name | Description |
---|---|
openDocument() |
Open the specified document by document uid. |
closeDocument() |
Close current document. |
currentDocument |
Return the object of the current document. |
getPageCount() |
Get the page count in the viewer. |
goToPage() |
Navigate to the specified page by index. |
getCurrentPageIndex() |
Get the index of current page. |
getCurrentPageUid() |
Get the uid of the current page. |
indexToUid() |
Get the uid of the specified page by its index. |
uidToIndex() |
Get the index of the specified page by its uid. |
getSelectedPageIndices() |
Get indices of selected pages. |
selectPages() |
Select pages by specified indices. |
selectAllPages() |
Select all pages. |
Display Control
API Name | Description |
---|---|
setRowAndColumn() |
Set rows and columns of displayed pages. |
Edit Operations
API Name | Description |
---|---|
rotate() |
Rotate the specified pages. |
saveOperations() |
Save the edit operations in pages to document. |
Events
API Name | Description |
---|---|
on() |
Bind a listener to the specified event. |
off() |
Unbind event listener(s) from the specified event. |
Integrated Events
Event Name | Description |
---|---|
resized |
Triggered when the viewer is resized. |
pageRendered |
Triggered when a page has been completely rendered. |
currentIndexChanged |
Triggered when currentIndex is changed. |
currentPageChanged |
Triggered when current page is changed. |
selectedPagesChanged |
Trigeered when the page(s) is selected. |
pagesDragged |
Triggered when page(s) is dragged. |
pagesDropped |
Triggered when page(s) is dropped. |
click |
Triggered when click in the viewer’s viewing area. |
dblclick |
Triggered when double click in the viewer’s viewing area. |
rightclick |
Triggered when right click in the viewer’s viewing area. |
CustomViewer Class
Create and Destroy Instances
API Name | Description |
---|---|
CustomViewer() |
Default constructor of a CustomViewer instance. |
destroy() |
Destroy the CustomViewer instance. |
Viewer Control
API Name | Description |
---|---|
bindContainer() |
Bind the viewer to the specified container. |
unbindContainer() |
Unbind the viewer from the specified container. |
isBoundContainer |
Return whether the viewer is bound to a container. |
getUiConfig() |
Get current UiConfig object. |
updateUiConfig() |
Update UiConfig object. |
show() |
Show the viewer. |
hide() |
Hide the viewer. |
isVisible |
Return whether the viewer is shown or hidden. |
Events
API Name | Description |
---|---|
on() |
Bind a listener to the specified event. |
off() |
Unbind event listener(s) from the specified event. |
Besides, there are two advanced classes.
Annotation
Annotation has eleven main classes:
Rectangle Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
Ellipse Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
Polygon Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
Polyline Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
Line Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
Ink Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
TextBox Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
TextTypewriter Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
Stamp Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
modificationDate |
Return the modification date of the annotation. |
getOptions() |
Get the annotation options. |
updateOptions() |
Update the annotation options. |
Incomplete Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |
raw |
Return the raw data of the annotation. |
Unknown Class
API Name | Description |
---|---|
uid |
Return the uid of the annotation. |
pageUid |
Return the uid of the page where the annotation is located. |
creationDate |
Return the creation date of the annotation. |