ImageGear .NET v25.1 - Updated
setScanner Method

ImageGear.Web.Isis Library > ImageGear.Web.Isis Namespace > ImGearIsisScannerSession class : setScanner Method
Loads and sets the specified scanner.
Syntax
ASP.NET Ajax Javascript (Specification) 
function setScanner( 
   scanner : ImGearIsisScanner,
   callback : function
) : ImGearIsisOperationStatus;
ASP.NET Ajax Javascript (Usage) 
var resultVar = instanceOfImGearIsisScannerSession.setScanner(ImGearIsisScanner,function);

Parameters

scanner
The scanner to set.
callback
Callback which is called after a scanner is set.

Return Value

Example

The JavaScript code below demonstrates how to set a scanner, where scannerSelect is an HTML select element that contains the scanners that were previously retrieved (and stored in the scanners variable) using the getScanners method:

function onScannerLoaded(status) {
    if (status.get_status() !== ImageGear.Web.Isis.ImGearIsisStatus.Completed) {
        alert(status.get_statusMessage());
    }

    // The scanner can now be accessed through the ImGearIsisScannerSession scanner property.
    var scanner = scannerSession.get_scanner();

    // You could use the getTag method or getAllTags method here
    // to get the current scanner settings.
}

var select = document.getElementById('scannerSelect');
var selectedScanner = scanners.getScanner(select.selectedIndex);

// Set the scanner that is selected in the connected list.
scannerSession.setScanner(selectedScanner, onScannerLoaded);
Remarks

This is an asynchronous method.

You must set a scanner before creating a scan job. Only one scanner can be set at a time. Any previously set scanner is unloaded automatically.

A list of scanners that are installed on the system can be retrieved using the ImageGear.Web.Isis.ImGearIsisScannerSession.getScanners method.

If you want to use a built-in user interface to show the scanner list or use the previously selected scanner, use the ImageGear.Web.Isis.ImGearIsisScannerSession.setScannerWithDialog method instead.

See Also

Reference

ImGearIsisScannerSession class
ImGearIsisScannerSession Members