Skip to content

Latest commit

 

History

History
333 lines (219 loc) · 10 KB

File metadata and controls

333 lines (219 loc) · 10 KB
layout needAutoGenerateSidebar needGenerateH3Content noTitleIndex title keywords breadcrumbText description permalink
default-layout
true
true
true
Dynamsoft Document Viewer API Reference - Namespace - Dynamsoft.DDV
Documentation, Dynamsoft Document Viewer, API Reference, Namespace, Dynamsoft.DDV
Dynamsoft.DDV
Dynamsoft Document Viewer Documentation API Reference Namespace Dynamsoft.DDV Page
/api/namespace/ddv.html

Dynamsoft.DDV

Index

Handler Configuration

API Name Description
<static> setProcessingHandler() Set a processing handler to the DDV system.

Members

API Name Description
<static> documentManager [DocumentManager]({{ site.api }}class/documentmanager.html) instance.

Classes

  • [DocumentManager]({{ site.api }}class/documentmanager.html)

  • [EditViewer]({{ site.api }}class/editviewer.html)

  • [CaptureViewer]({{ site.api }}class/captureviewer.html)

  • [PerspectiveViewer]({{ site.api }}class/perspectiveviewer.html)

  • [BrowseViewer]({{ site.api }}class/browseviewer.html)

  • [CustomViewer]({{ site.api }}class/customviewer.html)

  • Advanced

    • [ImageFilter]({{ site.api }}class/advanced/imagefilter.html)
    • [DocumentDetect]({{ site.api }}class/advanced/documentdetect.html)

Methods

API Name Description
<static> getDefaultUiConfig() Get default UiConfig object.
<static> clearLastError() Clear the last error or warning.
<static> unload() Unload all DDV resources.

Properties

API Name Description
<static> lastError Return the last error or warning.

Events

API Name Description
<static> on() Bind a listener to the specified event.
<static> off() Unbind event listener(s) from the specified event.

Integrated Events

Event Name Description
error Triggered when any error occurs.
warning Triggered when any warning occurs .
verbose Triggered when DDV is running.

Handler Configuration

<static> setProcessingHandler()

Set a processing handler to the DDV system.

Syntax

static setProcessingHandler(handlerType: HandlerType, handler: any): void;

Parameters

handlerType: The type of processing handler.

A HandlerType can be one of two types.

type HandlerType = "documentBoundariesDetect"|"imageFilter";

handler: The handler to set. Please refer to [IDocumentDetect]({{ site.api }}interface/idocumentdetect.html) and [IImageFilter]({{ site.api }}interface/iimagefilter.html).

Exception

Error Code Error Message
-80100 XXX(API): XXX(ParameterName) is invalid.
-80102 XXX(API): XXX(ParameterName) is missing.
-80103 XXX(API): The value for XXX(ParameterName) is not supported.

Remark

  • Please configure the handler before creating
  • If documentBoundariesDetect handler is not set, the default element Dynamsoft.DDV.Elements.AutoDetect will be disabled.
  • If imageFilter handler is not set, the default element Dynamsoft.DDV.Elements.Filter will be disabled.
  • [How to configure image filter]({{ site.features }}advanced/imagefilter.html)
  • [How to configure boundaries detection]({{ site.features }}advanced/documentdetect.html)

Member

<static> documentManager

[DocumentManager]({{ site.api }}class/documentmanager.html) instance.

Code Snippet

Dynamsoft.DDV.Core.license = "Your-License-String";
Dynamsoft.DDV.Core.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@1.1.0/dist/engine"; // lead to a folder containing the distributed WASM files
await Dynamsoft.DDV.Core.init(); 

const docManager = Dynamsoft.DDV.documentManager;

Methods

API Name Description
<static> getDefaultUiConfig() Get default UiConfig object.
<static> clearLastError() Clear the last error or warning.
<static> unload() Unload all DDV resources.

<static> getDefaultUiConfig()

Get default UiConfig object.

Syntax

static getDefaultUiConfig(viewerType: ViewerType): UiConfig | null;

Parameters

viewerType: A ViewerType can be one of three types.

type ViewerType = "editViewer"|"captureViewer"|"perspectiveViewer"|"browseViewer";

Return Values

The [default UiConfig]({{ site.ui }}default_ui.html) object for each kind of viewer.

Code Snippet

const defaultEditUi = Dynamsoft.DDV.getDefaultUiConfig("editViewer");

Warning

Error Code Error Message API Return Value
-80100 XXX(API): XXX(ParameterName) is invalid. null
-80102 XXX(API): XXX(ParameterName) is missing. null
-80103 XXX(API): The value for XXX(ParameterName) is not supported. null

<static> clearLastError()

Clear the last error or warning.

Syntax

static clearLastError(): void;

Remark

  • Once called this method, lastError will return undefined.

<static> unload()

Unload all DDV resources.

Syntax

static unload(): void;

Properties

API Name Description
<static> lastError Return the last error or warning.

<static> lastError

Return the last error or warning.

Syntax

static readonly lastError: DDVError;

Return Values

A [DDVError]({{ site.api }}interface/ddverror.html) object.

Events

API Name Description
<static> on() Bind a listener to the specified event.
<static> off() Unbind event listener(s) from the specified event.

<static> on()

Bind a listener to the specified event.

Syntax

static on(eventName: EventName, listener:(event:EventObject)=>void): void;

Parameters

eventName: Specify the event name. It can be an integrated event name.

listener: Specify the listener.

Code Snippet

Dynamsoft.DDV.on("error", (e)=>{
    console.log(e.message, e.cause);
});

Exception

Error Code Error Message
-80100 XXX(API): XXX(ParameterName) is invalid.
-80102 XXX(API): XXX(ParameterName) is missing.
-80103 XXX(API): The value for XXX(ParameterName) is not supported.

<static> off()

Unbind event listener(s) from the specified event.

Syntax

static off(eventName: EventName, listener?:(event:EventObject)=>void): void;

Parameters

eventName: Specify the event name. It can be an integrated event name.

listener: Specify the listener. If no listener is specified, unbind all event listeners from the specified event.

Code Snippet

Dynamsoft.DDV.off("error");

Exception

Error Code Error Message
-80100 XXX(API): XXX(ParameterName) is invalid.
-80102 XXX(API): XXX(ParameterName) is missing.
-80103 XXX(API): The value for XXX(ParameterName) is not supported.

Integrated Event

Event Name Description
error Triggered when any error occurs.
warning Triggered when any warning occurs .
verbose Triggered when DDV is running.

error

Triggered when any error occurs.

Callback

An EventObject which contains the detailed error info.

Attributes

DDVError: Detailed error info.

warning

Triggered when any warning occurs.

Callback

An EventObject which contains the detailed warning info.

Attributes

DDVError: Detailed warning info.

verbose

Triggered when DDV is running.

Callback

EventObject array which contain the detailed verbose info.

Example

Dynamsoft DDV.on("verbose", (...args) => { 
    console.log(...args); 
    if (args[0].cause) { 
        console.error(args[0].cause); 
    } 
});