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

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
all versions not supported not supported not supported not supported not supported

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

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
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

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

SetLanguage

Syntax

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

Availability

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
not supported v14.0+ v15.1+ v15.1+ v15.1+ 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.


ErrorCode

Syntax

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

Availability

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
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.


VersionInfo

Syntax

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

Availability

Desktop Service Edition WebAssembly Edition
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

Desktop Service Edition WebAssembly Edition
ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) WASM
v9.0+ v10.0+ v11.0+ v11.0+ v12.1+ not supported

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

Desktop Service Edition WebAssembly Edition
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.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