Resource Base
Table of contents

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

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

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

latest version

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