Batch Scanning

Q:  How can I easily scan many pages without user interface?

A:  If you want to scan many pages and you have a scan feeder, you can solve this  problem with some BITWAIN.DLL functions. You can specify the compression mode of the output file(s) with twSetBatchScanImageCompressionfunction (see the description of the function), the output file name and the scanning mode with twBatchScanfunction (see the sample below). You can scan the pages into a multipage tiff file or every page into a separate single page TIFF file. If you scan single page files, the output files will be numbered. For example the output file name is output.tif, the file names will be output000001.tif, output000002.tif, output000003.tif ect.You can specify the displaying of the pre-scan user interface with twSetUIEnablefunction (see the description of the function). If  the pre-scan user interface does not allowed you have many functions in the BITWAIN.DLL to change the scanning properties from the program.

 

Code example:

      

       int ret;

       BOOL bMultiPage = TRUE;

       UINT pages = 20;                                         // number of page to scan

       twSetFeederEnable(TRUE);                       // Enable scanning from the feeder

ret = twSetBatchScanImageCompression(TCOMP_LZW_DIFF);

if (ret != TW_OK)

{

      AfxMessageBox("Error setting compression mode for batch scanning.",
MB_OK|MB_ICONERROR, NULL);

         return;

}

if (!strlen(m_szFileName))

{

         AfxMessageBox("You must specify the output TIFF file", MB_OK|MB_ICONERROR, NULL);

         return;

}

twSetUIEnable(TRUE);               // Allow displaying of the pre-scan user interface

twBatchScan(m_szFileName, bMultiPage, pages);