ImageGear Professional DLL v17.1 for Windows Accusoft
Checking the Feeder and Incrementing Filenames
Send Feedback  
ImageGear Professional DLL v17.1 for Windows > User Guide > Using ImageGear > Scanning Images > Scanning Images Using the ISIS Interface > More ISIS Characteristics > Checking the Feeder and Incrementing Filenames

Glossary Item Box

The following example uses IG_ISIS_drv_is_loaded to continue scanning as long as there are pages in the feeder. For each page scanned, a TIFF file is created called FILEnn.TIF, where nn is a number that increments with each page scanned.

  Copy Code
#define BUFSIZE 8192
 
AT_ERRCOUNT ScanBatch(HISISDRV hDriver)
{
AT_ERRCOUNT nErrCount;
LONG lValue, dwBits;
char Buffer[BUFSIZE];
HISISDRV hFile;
int iPage;
char lpcFileName[80];
 
/* Load and initialize the file writing driver */
nErrCount = IG_ISIS_drv_load_init_pipe(0, "PIXFPACK", &hFile, 0);
if (nErrCount != IGE_SUCCESS)
return nErrCount;
 
/* Link already-loaded scanner driver with file writing driver. */
IG_ISIS_drv_link(hDriver, hFile);
 
/* Set the file type and open attributes */
IG_ISIS_tag_set_long(hFile, IG_ISIS_TAG_FILETYPE, 0, IG_ISIS_FILETYPE_TIFF);
IG_ISIS_tag_set_long(hFile, IG_ISIS_TAG_OPENATTRIBUTE, 0,
IG_ISIS_OPENATTRIBUTE_CREATE | IG_ISIS_FILE_BOTH);
 
/* Check whether there is a page loaded */
IG_ISIS_tag_get_long(hDriver, IG_ISIS_TAG_FEEDER, 0, &dwBits);
if (dwBits & IG_ISIS_FEEDER_TELLFEED) {
IG_ISIS_drv_is_page_loaded(hDriver, IG_ISIS_TAG_FEEDER_FEED, &dwBits);
if (dwBits & IG_ISIS_DRV_STACKPAGE)
printf("There is a page ready in the feeder.");
else
printf("The feeder is empty.");
} else
printf("Can't tell if page is loaded.");
 
nErrCount = IG_ISIS_drv_is_page_loaded(hDriver, IG_ISIS_FEEDER_FEED, &lValue);
 
/* Clean up if an error occurs */
if (nErrCount != IGE_SUCCESS)
IG_ISIS_drv_link(hDriver, 0);
IG_ISIS_drv_unload(hFile) ;
return nErrCount;
}
/* While there is a page in the feeder, get ready to scan by
* incrementing a numeric portion of the filename for each page
* scanned. */
while (lValue == IG_ISIS_DRV_STACKPAGE) {
wsprintf(lpcFileName, "FILE%04d", iPage++);
IG_ISIS_tag_set_ascii(hDriver, IG_ISIS_TAG_OUTPUTNAME, lpcFileName);
 
/* Run the zone */
nErrCount = IG_ISIS_run_zone(hDriver, Buffer, BUFSIZE);
 
/* Clean up if an error occurs */
if (nErrCount != IGE_SUCCESS) {
IG_ISIS_drv_link(hDriver, 0);
IG_ISIS_drv_unload(hFile);
return nErrCount;
}
 
/* Check for page in feeder again, and stay in the loop if present */
nErrCount = IG_ISIS_drv_is_page_loaded(hDriver, IG_ISIS_TAG_FEEDER_FEED, &lValue);
 
/* Clean up if an error occurs */
if (nErrCount != IGE_SUCCESS) {
IG_ISIS_drv_link(hDriver, 0);
IG_ISIS_drv_unload(hFile);
return nErrCount;
}
}
/* Clean up if successful */
IG_ISIS_drv_link(hDriver, 0);
IG_ISIS_drv_unload(hFile);
return IGE_SUCCESS;
}

In the above example, the scanner driver was already loaded by some previous code in the application. This code fragment does not attempt to unload the scanner driver because it didn't load it. When using IG_ISIS_drv_is_loaded(), remember that the information about whether or not a page is loaded is in the function's third parameter (&lValue), not in the return value. A negative return value from IG_ISIS_drv_is_loaded() means there was an error completing the function.

©2012. Accusoft Corporation. All Rights Reserved.