DTWAIN_EnableJobFileHandling
The DTWAIN_EnableJobFileHandling function turns on or off DTWAIN's creation of image files if job control has been invoked..
DTWAIN_BOOL DTWAIN_EnableJobFileHandling (
Parameters Source An open TWAIN Source.
bEnable Determines whether to turn on or off handling of file creation for job control..
Return Values The return value is TRUE if successful. Otherwise FALSE is returned.
Comments The DTWAIN_EnableJobFileHandling function turns on or off the automatic handling of creating files whenever DTWAIN detects that an end-of-job has been reached when acquiring a set of pages. If bEnable is TRUE, the job file handling is turned on, else it is turned off. This function should be called before acquiring any images. Please note that the DTWAIN_EnableJobFileHandling will only work for TWAIN Sources that support job control (DTWAIN_IsJobControlSupported). If the device does not support TWAIN job control, the DTWAIN_EnableJobFileHandling function has no effect.
If DTWAIN_SetJobControl is called with an argument other than DTWAIN_JC_NONE, DTWAIN will automatically detect when an "end-of-job" page or marker has been detected, and will notify the application through the notification codes DTWAIN_TN_EOJDETECTEDXFERDONE and DTWAIN_TN_EOJDETECTED that an end-of-job has occurred.
If DTWAIN_AcquireFile or DTWAIN_AcquireFileEx is used to acquire images from the TWAIN device, by default, DTWAIN saves all pages to a multipage image file once all pages have been acquired (same as calling DTWAIN_EnableJobFileHandling with bEnable equal to FALSE). In this case, there is no special handling that DTWAIN will do if an end-of-job has been detected except to send notifications to the application.
However, if an application wants DTWAIN to save each completed job to a file, the DTWAIN_EnableJobFileHandling must be called with bEnable as TRUE.
Example:
There are 11 pages, including job control pages, and the pages are set up in the following order:
1, 2, 3, 4, <jc>, 6, 7, 8, <jc> 10, 11
the <jc> is the job control page that marks the end-of-job.
Assuming the TWAIN device in the example below is a scanner that is equipped with a document feeder, and the device supports job control, the following series of DTWAIN calls are done:
DTWAIN_SetJobControl( Source, DTWAIN_JC_JSXC ); // exclude job control sheet from acquired pages, DTWAIN_EnableJobFileHandling( Source, TRUE ); // enable job file handling DTWAIN_SetFileAutoIncrement( Source, 1, TRUE, TRUE ); // enable auto-incrementing file name
// acquire to a multipage TIFF Group4 file DTWAIN_AcquireFile( Source, "JOB000.TIF", DTWAIN_TIFFG4MULTI, DTWAIN_USENAME, DTWAIN_PT_BW, DTWAIN_ACQUIREALL, FALSE, TRUE, NULL);
The following multipage TIFF files will be created if there are no other errors after the DTWAIN_AcquireFile is completed:
JOB000.TIF (pages 1, 2, 3, 4) JOB001.TIF (pages 6, 7, 8) JOB002.TIF (pages 10, 11)
Note that three files are created consisting of the pages in the batch that constituted each job. The job control page was excluded, since the type of job was DTWAIN_JC_JSXC (exclude the job control sheet from the acquisition and keep scanning).
If the call to DTWAIN_EnableJobFileHandling had a FALSE argument (or was not called at all), the following would be created:
JOB000.TIF (all pages excluding the job-control pages).
Note that a single TIFF file would have been created.
TWAIN State Transitions The Source must be in State 4 or higher
Prerequisite Function Call(s) DTWAIN Source Selection Function
|