Thanks for Downloading Dynamic Web TWAIN 30-Day Trial!
Your download will start shortly. If your download does not begin, click here to retry.
{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() |
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: (...arg: any[]) => 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.
UnregisterEvent()
Remove an event listener from the specified built-in event.
Syntax
UnregisterEvent(name: string, callback?: (...arg: any[]) => 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+ |
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 toEnumDWT_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+ |
Example
var dsUploadManager;
Dynamsoft.FileUploader.Init(
"",
function (obj) {
dsUploadManager = obj;
},
function () {}
);
DWTObject.GenerateURLForUploadData(
[0, 1],
EnumDWT_ImageType.IT_PDF,
function (resultURL, newIndices, enumImageType) {
var serverUrl = "https://yoursite/yourserverurl.aspx";
var jobtemp = dsUploadManager.CreateJob();
jobtemp.ServerUrl = serverUrl;
jobtemp.SourceValue.Add(resultURL, "uploadedFile.pdf");
dsUploadManager.Run(jobtemp);
},
function (
erroCode,
errorString
) {}
);
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:
- Windows
C:\Windows\SysWOW64\Dynamsoft\DynamsoftServicex64_{versionnumber}\log
orC:\Users\{UserName}\AppData\Roaming\Dynamsoft\DynamsoftService\log
- macOS,
Go > Applications > Dynamsoft > DynamsoftServicex64_{versionnumber} > {installed version No.} > log
- Linux:
/opt/dynamsoft/DynamsoftService/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.