ImageGear for C and C++ on Windows v19.0
ScanAhead

ScanAhead is a PixTools feature that allows a scanner to achieve a higher throughput by scanning pages that the application hasn't yet requested. Most document imaging scanners today support ScanAhead, including those from Fujitsu, Ricoh, Bell & Howell, Canon, Panasonic, and numerous others. Kodak scanners operate in ScanAhead mode only. IG_ISIS_TAG_SCANAHEAD is a tag that controls whether or not a scanner operates in ScanAhead mode. If your application is written so that it supports IG_ISIS_TAG_SCANAHEAD, it will also work correctly for non-ScanAhead scanners.

This section provides information about the following:

ScanAhead Off

If ScanAhead is off, invoking IG_ISIS_run_zone() tells the scanner driver to scan one page. An ordinary scanner will scan one page, output the data for that page, and wait for another IG_ISIS_run_zone() before scanning the next page. There are two cases when the scanner will actually scan one page ahead of the application, even though ScanAhead is not turned on:

  1. If the scanner is a duplex model (capable of scanning both sides of the page at one time) and duplex mode is enabled, both sides of the page are scanned simultaneously, but another IG_ISIS_run_zone() must be issued to obtain the data from the back side. This makes duplex scanning almost transparent to the application. Even though ScanAhead is not on, the application gets both sides of the page with one physical scan, even though the application only requested one side.
  2. When working with a scanner whose IG_ISIS_TAG_FEEDER tag contains IG_ISIS_FEEDER_TELLSCAN . This type of scanner must scan a page when requested to sense whether or not there is a page in the feeder. Once a page is sensed, that page has already been scanned and the data is waiting for the application to request it. When the application issues a IG_ISIS_run_zone(), the data from the page that was already scanned is transferred to the application.

ScanAhead On

If ScanAhead is on when the application issues a IG_ISIS_run_zone() call, the toolkit begins a batch scanning process. The scanner continues to scan pages even though the application may not have requested them. The result is that when the application is running zones, it is probably getting image data that was scanned some time ago while the driver continues to scan more pages. The application can configure the maximum number of pages to scan ahead, if desired, as explained below.

If ScanAhead had no settings or controls, the behavior described above would be the only behavior - the application would continue scanning until the feeder was empty. However, the following tags and functions allow your application to have more control over how ScanAhead works:

IG_ISIS_TAG_SCANAHEAD_PAGES

Returns how many pages have been scanned ahead.

IG_ISIS_TAG_SCANAHEAD_MAXPAGES

Tells the scanner driver how many pages it is allowed to scan ahead. A value of zero means scan until the feeder is empty.

IG_ISIS_drv_send(hScan, IG_ISIS_DRV_SCANAHEADCLEAR, 0, 0);

Causes the driver to throw out all pages that have been scanned ahead but not read by the application. The IG_ISIS_DRV_SCANAHEADCLEAR message discards back pages from duplex scans as well, regardless of whether ScanAhead is on or off.

Duplex Scanning

When scanning in duplex mode, the application should not rely on IG_ISIS_TAG_SCANAHEAD_PAGES to find out whether or not there is a back side waiting to be read, even though some scanners (such as Ricohs) will put this information into this tag. The application should keep track of pages scanned in pairs, and is often required to do so anyway because of file naming requirements for front and back sides.

Pixsl

Pixsl is a DLL and an API that is supplied with PixTools/Scan. It is a batch scanning utility that handles scanning from both feeder and flatbed, takes care of ScanAhead issues, provides automatic file naming of multiple files, including front/back sides and job separators, and performs other important functions related to high-throughput scanning. If you do not want to use Pixsl in your application, you should take a look at how it works so that you can cover all important cases in your batch scanning code. The Pixsl user interface can be seen in PixUtil Demo after choosing Scan Batch to File and naming the file(s) to store the image(s). A dialog box appears.

Note some of the features of this dialog. It gives the user the opportunity to continue scanning the front sides of pages or to turn a stack over and scan the back sides in reverse order. It allows the user to specify the number of pages to scan, and it lets the user specify a paper source (flatbed or feeder and, if connected to a duplex scanner, whether or not duplex mode is enabled). If the scanner supports hardware batch detection, this dialog allows the user to specify how to separate batches (whether to keep or discard the batch separation sheet), and it lets the user enable or disable ScanAhead.

Behind the scenes, Pixsl makes sure that if the user cancels scanning with ScanAhead on, scanning resumes at the correct page number. Pixsl also can save and restore its state so that its settings are maintained when the application next uses it.

IG_ISIS_DRV_SCANAHEADCLEAR

The IG_ISIS_DRV_SCANAHEADCLEAR message that can be sent by calling IG_ISIS_drv_send() discards all pages that have been scanned but not yet transferred to the application by IG_ISIS_run_zone() or equivalent calls. The return value of IG_ISIS_drv_send indicates how many pages were discarded, allowing your application to prompt the user to reload the last n pages for rescanning. It is usually better to have your application process all the pages in a ScanAhead buffer instead of using IG_ISIS_DRV_SCANAHEAD_CLEAR . This can be done by setting IG_ISIS_TAG_SCANAHEAD to zero (stopping ScanAhead) and doing IG_ISIS_run_zone until all pages are retrieved. 

Canceling Scanning

Many ISIS scanner drivers are designed to occasionally yield to other operating system tasks so that, among other things, scanning can be canceled. There are some cases, however, where even though the driver is doing the right thing, the scan cannot be canceled. This may happen when there is too much competition for processor time, such as when the computer is allocating memory and disk space for a large scan, when there are other processor-intensive processes running, or when an application is poorly designed.

When a scan is successfully canceled, any image data that has been scanned ahead is discarded. These scanned ahead pages are not left somewhere in memory for the application to access later.

Your application will receive a IG_ISIS_DRV_STACKNO-PAGE message in response to a IG_ISIS_drv_is_loaded function call at the time when the last image that has been scanned (ahead) is actually received by the application, and not when the feeder is actually empty. (This behavior helps to make ScanAhead transparent to the application.)

Some scanners do not actually support ScanAhead (notably the Ricoh 410 and Fujitsu 309x series). In such scanners, ScanAhead is implemented in the ISIS driver. Other scanners have ScanAhead built into the scanner hardware, and the ISIS driver just turns the feature on. In scanners that implement ScanAhead themselves, your application has no way of knowing for certain how far ahead pages have been scanned. (The scanned-ahead data is held in the scanner until requested by the application.) In scanners that implement ScanAhead in the ISIS driver, the application can always be certain of the number of pages scanned ahead. Your application will therefore see some differences in the data returned by the IG_ISIS_TAG_SCANAHEAD_PAGES tag. Therefore, you can use IG_ISIS_TAG_SCANAHEAD_PAGES as a general indicator that there are some pages that have been scanned ahead remaining to be retrieved, but not as an absolute indicator of how many pages are remaining.

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback