This code segment shows how to scan all the pages in the scanner's automatic document feeder (ADF) to a multipage file using a file template. The example creates three image pages and names them using the prefix "img" (for example, img0001.tif, img0002.tif).
void CNewscanDlg::OnTemplate()
{
ImgScan1.SetScanTo (4); // UseFileTemplateOnly // 4
// Set the image property to a template name.
ImgScan1.SetImage ("D:\\image2\\img");
// Multipage must be true in order to create files with
// more than one page.
ImgScan1.SetMultiPage(TRUE);
// Create 3 page image files.
ImgScan1.SetPageCount(3);
// Do not show the scanner's TWAIN UI.
ImgScan1.SetShowSetupBeforeScan(FALSE);
// Scan without using dialog box.
ImgScan1.StartScan();
}