setCapabilitiesAsync Method
In This Topic
Sends an asynchronous request to set values of TWAIN device capabilities.
Syntax
var instance = new Vintasoft.Twain.WebTwainDeviceJS(deviceName, productFamily, manufacturer, driverVersion, twainVersion, deviceManager, is64Bit);
var value; // Type: any
// Parameters
var twainCapabilitiesInfo; // Type: object[]
var successFunc; // Type: function
var errorFunc; // Type: function
value = instance.setCapabilitiesAsync(twainCapabilitiesInfo, successFunc, errorFunc);
function setCapabilitiesAsync(
: object[],
: Function,
: Function
) : any;
Parameters
- twainCapabilitiesInfo
- An array that contains information about capabilities, which must be set. Each element of array must contain 2 fields: field "capabilityId" and field "capabilityValue". Field "capabilityId" must contain name of TWAIN device capability (list of available names can be get from WebDeviceCapabilityIdEnumJS enumeration). Field "capabilityValue" must contain value of TWAIN device capability.
- successFunc
- A function that will be executed if request is executed successfully. Function prototype: "successFunc(twainDevice, setCapResults)", where 'twainDevice' parameter is an instance of WebTwainDeviceJS class, 'setCapResults' parameter is an array with results of operations, which set values of TWAIN device capabilities.
- errorFunc
- A function that will be executed if request is failed. Function prototype: "errorFunc(twainDevice, errorMessage)", where 'twainDevice' parameter is an instance of WebTwainDeviceJS class, 'errorMessage' parameter is string that describes error.
Exceptions
Exception | Description |
| Thrown if arguments have wrong types OR device is not opened OR error occurs during setting value of device capability. |
Remarks
This function sends an asynchronous request to set values of TWAIN device capabilities. If you want to use synchronous request instead of asynchronous request, please use WebTwainDeviceJS.setCapabilities function.
Example
// create information about capabilities, which should be set
var twainCapabilitiesInfo = [
{ "capabilityId": "IPixelType", "capabilityValue": 1 },
{ "capabilityId": "IXResolution", "capabilityValue": 200 },
{ "capabilityId": "IYResolution", "capabilityValue": 200 },
{ "capabilityId": "FeederEnabled", "capabilityValue": true },
{ "capabilityId": "DuplexEnabled", "capabilityValue": true }
];
// send an asynchronous request to set capabilities of TWAIN scanner
twainDevice.setCapabilitiesAsync(twainCapabilitiesInfo, __twainDevice_setCapabilitiesAsync_success, __twainDevice_setCapabilitiesAsync_error);
Browser Compatibility
See Also