getCapabilities(Vintasoft.Twain.WebDeviceCapabilityIdEnumJS[],Vintasoft.Twain.WebTwainDeviceCapabilityUsageModeEnumJS) Method
In This Topic
Returns information about TWAIN device capabilities.
Syntax
var instance = new Vintasoft.Twain.WebTwainDeviceJS(deviceName, productFamily, manufacturer, driverVersion, twainVersion, deviceManager, is64Bit);
var value; // Type: Vintasoft.Twain.WebTwainCapabilityInfoJS
// Parameters
var twainCapabilityIds; // Type: WebDeviceCapabilityIdEnumJS[]
var usageMode; // Type: WebTwainDeviceCapabilityUsageModeEnumJS
value = instance.getCapabilities(twainCapabilityIds, usageMode);
Parameters
- twainCapabilityIds
- An array of instances of WebDeviceCapabilityIdEnumJS class.
- usageMode
- An instance of class WebTwainDeviceCapabilityUsageModeEnumJS.
Return Value
An array of instances of
WebTwainCapabilityInfoJS class.
Exceptions
Exception | Description |
| Thrown if argument has wrong type OR device is not opened OR error occurs during getting information about supported device capabilities. |
Remarks
This function sends a synchronous request to get information about TWAIN device capabilities. If you want to use asynchronous request instead of synchronous request, please use WebTwainDeviceJS.getCapabilitiesAsync function.
Example
// Gets information about PixelType, XResolution and YResolution capabilities of opened TWAIN device.
function getSupportedTwainDeviceCapabilities() {
try {
var pixelTypeCap = new Vintasoft.Twain.WebDeviceCapabilityIdEnumJS("IPixelType");
var xResCap = new Vintasoft.Twain.WebDeviceCapabilityIdEnumJS("IXResolution");
var yResCap = new Vintasoft.Twain.WebDeviceCapabilityIdEnumJS("IYResolution");
// specify that we need to get current value of TWAIN device capability
var capUsageMode = new Vintasoft.Twain.WebTwainDeviceCapabilityUsageModeEnumJS("GetCurrent");
// get information about capabilities of opened TWAIN device
var twainCapInfos = twainDevice.getCapabilities([pixelTypeCap, xResCap, yResCap], capUsageMode);
// for each capability
for (var i = 0; i < twainCapInfos.length; i++) {
var twainCapInfo = twainCapInfos[i];
// output information about capability identifier, name and current value to the log
console.log("Capability ID: " + twainCapInfo.get_Id() + " Capability name: " + twainCapInfo.get_Name() + " Current value: " + twainCapInfo.get_CurrentValue());
}
}
catch (ex) {
alert(ex);
}
}
Browser Compatibility
See Also