VintaSoft Twain .NET SDK 15.0: Documentation for Web developer
Vintasoft.Twain Namespace / WebTwainDeviceJS type / getCapabilityAsync Methods / getCapabilityAsync(Vintasoft.Twain.WebDeviceCapabilityIdEnumJS,Vintasoft.Twain.WebTwainDeviceCapabilityUsageModeEnumJS,function,function) Property
Syntax Exceptions Remarks Example BrowserCompatibility SeeAlso
In This Topic
    getCapabilityAsync(Vintasoft.Twain.WebDeviceCapabilityIdEnumJS,Vintasoft.Twain.WebTwainDeviceCapabilityUsageModeEnumJS,function,function) Method
    In This Topic
    Sends an asynchronous request to get value of TWAIN device capability.
    Syntax
    var instance = new Vintasoft.Twain.WebTwainDeviceJS(deviceName, productFamily, manufacturer, driverVersion, twainVersion, deviceManager, is64Bit);
    
    var value; // Type: any
    
    // Parameters
    var twainCapabilityId; // Type: WebDeviceCapabilityIdEnumJS
    var usageMode; // Type: WebTwainDeviceCapabilityUsageModeEnumJS
    var successFunc; // Type: function
    var errorFunc; // Type: function
    
    value = instance.getCapabilityAsync(twainCapabilityId, usageMode, successFunc, errorFunc);
    
    
    function getCapabilityAsync(
    twainCapabilityId
    An instance of WebDeviceCapabilityIdEnumJS class that defines identifier of TWAIN device capability.
    : WebDeviceCapabilityIdEnumJS,
    usageMode
    An integer value, which defines usage mode of device capability.
    : WebTwainDeviceCapabilityUsageModeEnumJS,
    successFunc
    A function that will be executed if request is executed successfully. Function prototype: "successFunc(twainDevice, capInfos)", where 'twainDevice' parameter is an instance of WebTwainDeviceJS class, 'capInfo' parameter is an array that contains information about TWAIN device capability.
    : Function,
    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.
    : Function
    ) : any;

    Parameters

    twainCapabilityId
    An instance of WebDeviceCapabilityIdEnumJS class that defines identifier of TWAIN device capability.
    usageMode
    An integer value, which defines usage mode of device capability.
    successFunc
    A function that will be executed if request is executed successfully. Function prototype: "successFunc(twainDevice, capInfos)", where 'twainDevice' parameter is an instance of WebTwainDeviceJS class, 'capInfo' parameter is an array that contains information about TWAIN device capability.
    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
    ExceptionDescription
    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 an asynchronous request to get information about TWAIN device capability. If you want to use synchronous request instead of asynchronous request, please use WebTwainDeviceJS.getCapability function.

    Example

    // Returns information about supported pixel types for opened TWAIN device.
    function getSupportedPixelTypes(twainDevice) {
        try {
            // specify that we need to get information about IPixelType capability
            var pixelTypeCap = new Vintasoft.Twain.WebDeviceCapabilityIdEnumJS("IPixelType");
            // specify that we need to get value of TWAIN device capability
            var capUsageMode = new Vintasoft.Twain.WebTwainDeviceCapabilityUsageModeEnumJS("Get");
            // send an asynchronous request to get supported values for IPixelType capability
            twainDevice.getCapabilityAsync(pixelTypeCap, capUsageMode, __twainDevice_getCapabilityAsync_success, __twainDevice_getCapabilityAsync_error);
        }
        catch (ex) {
            alert(ex);
        }
    }
    function __twainDevice_getCapabilityAsync_success(twainDevice, capInfos) {
        // get an instance of WebTwainCapabilitySupportedValuesJS class that contains information about supported values of IPixelType capability
        var supportedValues = twainCapInfo.get_SupportedValues();
        // get an array with supported values of IPixelType capability
        var supportedValuesArray = supportedValues.get_SupportedValuesAsArray();
        // output supported pixel types to the console
        var consoleString = "Supported pixel types: ";
        for (var i = 0; i < supportedValuesArray.length; i++) {
            consoleString += supportedValuesArray[i].toString() + ' ';
        }
        console.log(consoleString);
    }
    function __twainDevice_getCapabilityAsync_error(twainDevice, errorMessage) {
        alert(errorMessage);
    }
    

    Browser Compatibility
    9
    See Also