Resource Base
Table of contents

DDV Class

Dynamsoft Document Viewer Javascript library comes with six primary classes:

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.

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.

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

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version
    Change +
    © 2003–2024 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support