Error Reporting and Manual Duplex Scanning

Top  Previous  Next

What happens if there is a problem scanning side 1 or side 2?

 

All errors when in manual duplex mode are reported using DTWAIN notifications, therefore if you want to handle error conditions, you must process the notifications.  If notifications are not processed, the user must scan successfully side 1 and side 2 without error or else the final image file will not contain all the pages.

 

The notifications sent when there is an error condition are as follows:

 

Notification code

Description

DTWAIN_TN_MANDUPPAGECOUNTERROR

The number of pages acquired for side 1 does not match the number of pages acquired for side 2.

DTWAIN_TN_MANDUPMERGEERROR

Both sides were acquired, but there was a problem in merging both side 1 and side 2 into a single image file.

DTWAIN_TN_MANDUPMEMORYERROR

Not enough memory to allocate for the merge operation.

DTWAIN_TN_MANDUPFILEERROR

Error in opening temorary image file that was created during the acquisition process.

DTWAIN_TN_MANDUPFILESAVEERROR

Error in saving the multi-page image file.

 

For the DTWAIN_TN_MANDUPPAGECOUNTERROR, the DTWAIN_GetManualDuplexCount( ) returns the number of pages scanned for either side 1 or side 2.  Your application can call this function if the DTWAIN_TN_MANDUPPAGECOUNTERROR is sent to determine which side did not scan all the pages (both side 1 and side 2 must have the same number of pages scanned).

 

If your application determines that side 1 should be rescanned, a return value of DTWAIN_MANDUP_SIDE1RESCAN must be returned from your notification handler.  If your application determines that side 2 should be rescanned, a return value of DTWAIN_MANDUP_SIDE2RESCAN must be returned.  If it is determined that both side 1 and side 2 should be rescanned, your notification handler must return DTWAIN_MANDUP_RESCANALL.  If it is determined that DTWAIN should go ahead and merge both sides as best as possible, return DTWAIN_MANDUP_SCANOK.

 

By default, when DTWAIN attempts to merge side 1 and side 2, and the page counts do not match for both sides, DTWAIN's strategy is to take the minimum number of pages needed to create a "good" document.  For example, if in a 10 page document, side 1 has successfully acquired pages 1, 3, 5, 7, 9, but side 2 has only scanned 2, 4, 6, and 8, DTWAIN will create a file that consists of pages 1, 2, 3, 4, 5, 6, 7, 8, and 9, leaving out page 10.

 

On the other hand, if side 1 scanned only 1, 3, 5, 7 and left out page 9, while side 2 scanned pages 2, 4, 6, 8, and 10, DTWAIN will create a file that consists of pages 1, 2, 3, 4, 5, 6, 7, and 8.