The ImGearIsisScannerSession scan method can be used to begin scanning, and you can specify the type of data (None, Base64Page, or Base64Document) that is available in the callback arguments using the scanDataType enum parameter. The enum values are 0, 4, and 8, and multiple data types can be specified. You can also specify a page retrieved callback (which is fired after each page is scanned) and a document retrieved callback (which is fired after all pages are scanned). If you do not specify a data type, then the corresponding property in the callback’s page/document arguments (ImGearIsisPageRetrievedResult/ImGearIsisDocumentRetrievedResult) will be null. The ImGearIsisPageRetrievedResult imageInfo and metadata properties provide information about the scanned image. The page/document retrieved callback also has an ImGearIsisStatus argument which can be used to check the status of the operation.
The code below demonstrates calling the scan method to scan all pages in the feeder as G4 compressed TIFF to retrieve a base 64 data string for each scanned page in the page scanned callback and to retrieve a base 64 data string containing all scanned pages in the scanned document.
JavaScript Example |
Copy Code |
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();
…
}
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}); |
The ImGearIsisScanJob cancel method can be used to cancel scanning. The destroy method can be used to destroy the scan job, which deletes all scanned images that were stored internally by the service.