Resource Base
Table of contents

Dynamsoft.DDV

Index

Initialization

API Name Description
<static> setConfig() Initialize license, engineResourcePath and so on.
<static> setProcessingHandler() Set a processing handler to the DDV system.

Members

API Name Description
<static> documentManager DocumentManager instance.

Classes

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.

Initialization

<static> setConfig()

Initialize license, engineResourcePath and so on.

Syntax

static setConfig(config: Configuration): Promise<ConfigResult>;

Parameters

config: The object which contains license, engineResourcePath and so on. Please refer to Configuration.

Return values

A Promise ConfigResult object.

Code Snippet

await Dynamsoft.DDV.setConfig({
    // Public trial license which is valid for 24 hours
    // You can request a 30-day trial key from https://www.dynamsoft.com/customer/license/trialLicense/?product=ddv
    license: "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9",
    engineResourcePath: "https://cdn.jsdelivr.net/npm/dynamsoft-document-viewer@1.0.0/dist/engine",
});

Exception

Error Code Error Message
-80100 XXX(API): XXX(ParameterName) is invalid.
-80102 XXX(API): XXX(ParameterName) is missing.

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

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
  • How to configure boundaries detection

Member

<static> documentManager

DocumentManager instance.

Code Snippet

await Dynamsoft.DDV.setConfig({
    license: "Your-License-String",
    engineResourcePath: "Resources/WASM/", // lead to a folder containing the distributed WASM files
});

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 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 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); 
    } 
});

Is this page helpful?

YesYes NoNo

In this article:

version 1.0.0

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