Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Dev Center
Table of contents

{WebTwainObject} Util

The properties and methods on this page live in the namespace {WebTwainObject}. {WebTwainObject} denotes the WebTwain instance. Learn about how to create a web twain object.

Methods

     
RegisterEvent() UnregisterEvent() SetProductKeyAsync()
SetLanguage() GenerateURLForUploadData()  

Properties

       
ErrorCode ErrorString LogLevel Manufacturer
ProductFamily ProductName VersionInfo ProductKey
UseLocalService      

isUsingActiveX

Syntax

/**
 * Return whether the WebTwain object is running the ActiveX edition.
 */
isUsingActiveX(): boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
all versions not supported not supported not supported not supported v16.2+

RegisterEvent

Syntax

/**
 * Specify an event listener for the specified built-in event.
 * @param name Specify the event
 * @param callback The event listener
 */
RegisterEvent(name: string, callback: () => void): boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v9.2+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

UnregisterEvent

Syntax

/**
 * Remove an event listener from the specified built-in event.
 * @param name Specify the event
 * @param callback The event listener
 */
UnregisterEvent(name: string, callback: () => void): boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v9.2+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

Usage notes

There can only be one listener for each built-in event. If you call RegisterEvent on the same event again, the new callback will replace the old one.


SetProductKeyAsync

Syntax

/**
 * Set the product key.
 * @param productKey Specify the key.
 */
SetProductKeyAsync(
    productKey: string
): Promise<any>;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v16.1+ v16.1+ v16.1+ v16.1+ v16.1+ v16.1+

SetLanguage

Syntax

/**
 * Set the language for the authorization dialogs.
 * @param language Specify the language.
 */
SetLanguage(
    language: Dynamsoft.DWT.EnumDWT_Language | number
): boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
not supported v13.0+ v13.0+ v13.0+ v13.0+ not supported

Usage notes

The language set with this method is only for the built-in security dialogs which show up when the user tries to access a scanner, a camera or a local file.


GenerateURLForUploadData

Syntax

/**
 * Generate a URL to be used by a FileUpoader instance to fetch the data to upload.
 * @param indices Specify the images to upload.
 * @param type Specify the file type.
 * @param successCallback A callback function that is executed if the request succeeds.
 * @param failureCallback A callback function that is executed if the request fails.
 * @argument resultURL The generated URL.
 * @argument indices The indices of the images.
 * @argument type The file type.
 */
GenerateURLForUploadData(
    indices: number[],
    type: Dynamsoft.DWT.EnumDWT_ImageType | number,
    successCallback: (
        resultURL: string,
        indices: number[],
        type: Dynamsoft.DWT.EnumDWT_ImageType | number
    ) => void,
    failureCallback: (
        errorCode: number,
        errorString: string
    ) => void
): void;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
not supported v14.0+ v15.1+ v15.1+ v15.1+ not supported

ErrorCode

Syntax

/**
 * Return the error code.
 */
readonly ErrorCode: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v1.0+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

Usage notes

The ErrorCode and ErrorString always reflect the result of the last API call. So make sure you read them in time.


ErrorString

Syntax

/**
 * Return the error string.
 */
readonly ErrorString: string;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v1.0+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

Usage notes

The ErrorCode and ErrorString always reflect the result of the last API call. So make sure you read them in time.


LogLevel

Syntax

/**
 * Return or set the log level for debugging.
 */
LogLevel: number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v6.3+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

Usage notes

The logs for the Dynamic Web TWAIN library are saved in the directory C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_17\log\. By default, LogLevel is 0 and nothing is recorded. When it is set to 1, all debugging information is recorded. This setting in your application will apply to all machines.

To enable logging on a specific machine, you can set LogLevel to 14 in this file: C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_17\DSConfiguration.ini.


Manufacturer

Syntax

/**
 * Manufacturer in the identity string of the Dynamic Web TWAIN library.
 */
readonly Manufacturer: string;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v1.0+ v10.0+ v11.0+ v11.0+ v12.1+ not supported

Usage notes

Manufacturer , ProductFamily , ProductName and VersionInfo together form the identity string of the Dynamic Web TWAIN library.


ProductFamily

Syntax

/**
 * ProductFamily in the identity string of the Dynamic Web TWAIN library.
 */
readonly ProductFamily: string;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v1.0+ v10.0+ v11.0+ v11.0+ v12.1+ not supported

Usage notes

Manufacturer , ProductFamily , ProductName and VersionInfo together form the identity string of the Dynamic Web TWAIN library.


ProductName

Syntax

/**
 * ProductName in the identity string of the Dynamic Web TWAIN library.
 */
readonly ProductName: string;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v1.0+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

Usage notes

Manufacturer , ProductFamily , ProductName and VersionInfo together form the identity string of the Dynamic Web TWAIN library.


VersionInfo

Syntax

/**
 * VersionInfo in the identity string of the Dynamic Web TWAIN library.
 */
readonly VersionInfo: string;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v1.0+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

Usage notes

Manufacturer , ProductFamily , ProductName and VersionInfo together form the identity string of the Dynamic Web TWAIN library.


ProductKey

Syntax

/**
 * Return or set the ProductKey.
 */
ProductKey: string;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v9.0+ v10.0+ v11.0+ v11.0+ v12.1+ v16.0+

Usage notes

The ProductKey contains the license to use the Dynamic Web TWAIN library. From version 16.1, if the license needs to be changed at runtime, use the method SetProductKeyAsync() instead.

UseLocalService

Syntax

/**
 * Return whether this WebTwain instance is in Local-Service mode or WASM mode.
 */
UseLocalService: boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
not supported v16.1+ v16.1+ v16.1+ v16.1+ v16.1+

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest Version
    • Version 17.2.1
    • Version 17.1.1
    • Version 17.0
    • Version 16.2
    • Version 16.1.1
    Change +
    © 2003–2022 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support