ImageGear .NET v24.12 - Updated
getScanners Method

ImageGear.Web.Isis Library > ImageGear.Web.Isis Namespace > ImGearIsisScannerSession class : getScanners Method
Gets a list of scanners that are installed on the system.
Syntax
ASP.NET Ajax Javascript (Specification) 
function getScanners( 
   callback : function
) : ImGearIsisOperationStatus;
ASP.NET Ajax Javascript (Usage) 
var resultVar = instanceOfImGearIsisScannerSession.getScanners(function);

Parameters

callback
Callback which is called after scanners are retrieved.

Return Value

Example

The JavaScript code below demonstrates how to get a list of the connected devices:

var scanners;
...
function getScannersCallback(connectedDevices, undetectedDevices, status) {
    if (status.get_status() !== ImageGear.Web.Isis.ImGearIsisStatus.Completed) {
        alert(status.get_statusMessage());
    }

    // Store the connected devices so they can be accessed later when calling the setScanner method.
    scanners = connectedDevices;
    var select = document.getElementById("scannerSelect");

    for (var i = 0; i < connectedDevices.get_length(); i++) {
        var scanner = connectedDevices.getScanner(i);
        var option = document.createElement("option");
        var scannerName = scanner.get_name();
        option.text = scannerName;
        select.add(option, null);
    }

    // Only devices that are connected and support the ISIS scanner auto-detection feature appear in the
    // connectedDevices collection. Other devices appear in the undetectedDevices collection, which can be
    // accessed using code similar to the code used above to access the connectedDevices collection.
}

// Get a list of connected scanners and add each to an HTML select element.
var operationStatus = scannerSession.getScanners(getScannersCallback);
Remarks

This is an asynchronous method.

The list is broken into two groups, connected devices and undetected devices, which are provided as ImGearIsisScannerCollections. The connected devices are detected using the ISIS scanner auto-detection feature. The undetected devices either aren't available or do not support the ISIS scanner auto-detection feature. Many devices cannot be automatically detected, so it is recommended to have a UI element such as a ListBox to show all the devices, not just the connected devices. The two groups will not have overlapping scanners.

Although the scanner collection is usually retrieved without user interaction, some scanner drivers might display a message box or other window when they are accessed. For example, an unlicensed driver might display a message about permissions.

See Also

Reference

ImGearIsisScannerSession class
ImGearIsisScannerSession Members