ImageGear.Web.Isis Namespace Client API Library > ImageGear.Web.Isis Namespace > ImGearIsisScannerSession class : scan Method |
ASP.NET Ajax Javascript (Specification) | |
---|---|
function scan( scanArgs : ImGearIsisScanArgs ) : ImGearIsisScanJob; |
ASP.NET Ajax Javascript (Usage) | |
---|---|
var resultVar = instanceOfImGearIsisScannerSession.scan(ImGearIsisScanArgs); |
The JavaScript code below demonstrates how to scan a G4 compressed TIFF and retrieve the base 64 data string for each scanned page and the base 64 data string for the scanned document:
function pageRetrievedCallback(result, status) { if (status.get_status() !== ImageGear.Web.Isis.ImGearIsisStatus.Completed) { alert(status.get_statusMessage()); } // Get the base 64 data string for the page. The ASP .NET ISIS sample demonstrates how to upload this string and display the image in a PageView control. var base64page = result.get_base64Page(); // Get the image info for the page. This object contains properties for getting the color format, compression, file type, width, height, and resolution. var imageInfo = result.get_imageInfo(); ... // You can also get the image metadata and the scanned page number. } function documentRetrievedCallback(result, status) { if (status.get_status() !== ImageGear.Web.Isis.ImGearIsisStatus.Completed) { alert(status.get_statusMessage()); } // Get the base 64 data string for the scanned document. var base64document = result.get_base64Document(); ... } // Passing 0 for the number of pages scans all pages in the feeder. You can specify a number greater than 0 to scan that number of pages. var scanJob = scannerSession.scan({pages: 0, scanDataType: ImageGear.Web.Isis.ImGearIsisScanDataType.Base64Page | ImageGear.Web.Isis.ImGearIsisScanDataType.Base64Document, fileType: ImageGear.Web.Isis.ImGearIsisFileType.Tif, compression: ImageGear.Web.Isis.ImGearIsisImageCompression.G4, pageRetrievedCallback: pageRetrievedCallback, documentRetrievedCallback: documentRetrievedCallback});
This is an asynchronous method.
This method returns an ImGearIsisScanJob object which can be used to track the status.
You must load a scanner before calling this method. Use the ImageGear.Web.Isis.ImGearIsisScannerSession.setScanner method or ImageGear.Web.Isis.ImGearIsisScannerSession.setScannerWithDialog method to load a scanner.
Starting a scan job does not automatically end previous scan jobs. However, only one job at a time can be actively scanning. Scanning occurs in the same sequence as the jobs were opened. When you start a new scan job, all scanning activity from previously opened jobs is completed before any images are scanned by the new job.
You can end a scan job (deleting its data) but continue working in the same session by calling the ImageGear.Web.Isis.ImGearIsisScanJob.destroy method.
This method can be passed an input parameter ImGearIsisScanArgs with properties pages, scanDataType, fileType, compression, pageRetrievedCallback, and documentRetrievedCallback. It is not necessary to create the ImGearIsisScanArgs. The parameters can also be passed as shown in the example.