The individual pages of the scan will be saved using the filespec, but with the page # appended. So if you set filespec = "scan.tif", the resulting files would be "scan-1.tif", "scan-2.tif", etc.
Typical multi-page scanning scenarios:
• Documents with fixed number of pages (say, 5). Set PAGES=5, and IMGSF_CONTINUE flag. Depending on the nature of the scanner and whether the IMGSF_HIDEUI flags is set, the user may see a dialog containing SCAN/CLOSE/CANCEL buttons. Or maybe the scanner just returns after each scan (in which case the subroutine will internally keep calling it until it gets the 5 pages or an explicit CANCEL or other error is returned). Assuming all goes well, the subroutine returns STATUS=0 and PAGES=5 to the caller. If it runs into an error on page 3 and can't continue, it would return PAGES=2 (2 pages scanned) and STATUS=<some error code>.
• Documents with variable number of pages. Set PAGES to a suitably high maximum value, perhaps 999999. If you are using the feeder to determine the end of the document (i.e. the operator will load exactly one document at a time), set IMGSF_ADFOUT. Else rely on the user to terminate the scan job after the desired number of pages. (Although there is some question whether it will always be possible to distinguish between a true "cancel", which should return STATUS=15, and "done" which ideally would return STATUS=0 to the application, but necessarily will have to return some other status to the internal interface to get it to stop scanning.) The application would presumably look at STATUS to make sure that the scan operation terminated normally, and then at PAGES to see how many pages were scanned.