{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
isUsingActiveX() |
RegisterEvent() |
UnregisterEvent() |
SetLanguage() |
GenerateURLForUploadData() |
Properties
ErrorCode |
ErrorString |
LogLevel |
Manufacturer |
ProductFamily |
ProductName |
VersionInfo |
The Android Service Edition only supports a subset of the APIs available in the Desktop Service Edition. For the APIs that are compatible with both editions, the usage remains the same. To learn how to use the APIs, please refer to the documentation for the Desktop Service Edition.
Methods
isUsingActiveX() |
RegisterEvent() |
UnregisterEvent() |
GenerateURLForUploadData() |
Properties
ErrorCode |
ErrorString |
LogLevel |
Manufacturer |
ProductFamily |
ProductName |
VersionInfo |
isUsingActiveX
Return whether the WebTwain object is running the ActiveX edition.
Syntax
isUsingActiveX(): boolean;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
all versions | all versions | all versions | all versions | all versions |
RegisterEvent
Specify an event listener for the specified built-in event.
Syntax
RegisterEvent(name: string, callback: () => void): boolean;
Parameters
name
: Specify the event.
callback
: The event listener.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v9.2+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
UnregisterEvent
Remove an event listener from the specified built-in event.
Syntax
UnregisterEvent(name: string, callback: () => void): boolean;
Parameters
name
: Specify the event.
callback
: The event listener.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v9.2+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
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.
SetLanguage
Set the language for the authorization dialogs.
Syntax
SetLanguage(
language: Dynamsoft.DWT.EnumDWT_Language | number
): boolean;
Parameters
language
: Specify the language. Please refer to EnumDWT_Language
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
not supported | v13.0+ | v13.0+ | v13.0+ | v13.0+ |
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
Generate a URL to be used by a FileUpoader instance to fetch the data to upload.
Syntax
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;
Parameters
indices
: Specify the images to upload.
type
: Specify the file type. Please refer to EnumDWT_ImageType.
successCallback
: A callback function that is executed if the request succeeds.
resultURL
: The generated URL.indices
: The indices of the images.type
: The file type. Please refer to EnumDWT_ImageType.
failureCallback
: A callback function that is executed if the request fails.
errorCode
: The error code.errorString
: The error string.
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
not supported | v14.0+ | v15.1+ | v15.1+ | v15.1+ |
ErrorCode
Return the error code.
Syntax
readonly ErrorCode: number;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v1.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
Usage notes
The ErrorCode
and ErrorString
always reflect the result of the last API call. So make sure you read them in time.
ErrorString
Return the error string.
Syntax
readonly ErrorString: string;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v1.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
Usage notes
The ErrorCode
and ErrorString
always reflect the result of the last API call. So make sure you read them in time.
LogLevel
Return or set the log level for debugging.
Syntax
LogLevel: number;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v6.3+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
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. Please set it back to 0 if you don’t need to record log as it will slow down the speed.
Manufacturer
Manufacturer in the identity string of the Dynamic Web TWAIN library.
Syntax
readonly Manufacturer: string;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v1.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
Usage notes
Manufacturer
, ProductFamily
, ProductName
and VersionInfo
together form the identity string of the Dynamic Web TWAIN library.
ProductFamily
ProductFamily in the identity string of the Dynamic Web TWAIN library.
Syntax
readonly ProductFamily: string;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v1.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
Usage notes
Manufacturer
, ProductFamily
, ProductName
and VersionInfo
together form the identity string of the Dynamic Web TWAIN library.
ProductName
ProductName in the identity string of the Dynamic Web TWAIN library.
Syntax
readonly ProductName: string;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v1.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
Usage notes
Manufacturer
, ProductFamily
, ProductName
and VersionInfo
together form the identity string of the Dynamic Web TWAIN library.
VersionInfo
VersionInfo in the identity string of the Dynamic Web TWAIN library.
Syntax
readonly VersionInfo: string;
Availability
ActiveX | H5(Windows) | H5(macOS/TWAIN) | H5(macOS/ICA) | H5(Linux) |
v1.0+ | v10.0+ | v11.0+ | v11.0+ | v12.1+ |
Usage notes
Manufacturer
, ProductFamily
, ProductName
and VersionInfo
together form the identity string of the Dynamic Web TWAIN library.