Open dynarithmic opened 8 months ago
This issue is related to #81
This aspect of how a driver is supposed to behave is defined in the TWAIN specification as "transitioning from "State 6 to State 5" when the driver detects that there are no more pages to scan.
Basically State 6 is the state where images are being acquired / scanned, and State 5 is the state where the user-interface is enabled, but also ready to scan more pages by the user if desired.
The Plustek driver, even though the driver itself states that no more pages are available to scan, does not return to State 5, thus the "Exit" button remains grayed out as if there are more pages to scan.
It seems that the following device has an issue:
The issue is that if the scanner user-interface is shown, the "Exit" button may become permanently grayed-out and disabled, thus not making it possible to close out the user interface after scanning is done.
Enabled Exit Button:![exitbtn](https://github.com/dynarithmic/twain_library/assets/1283116/af40c5a1-7f94-4431-98eb-79726d5be63b)
Grayed/Disabled Exit Button after scanning less pages than the number of pages in the feeder:![exitbtn_disabled](https://github.com/dynarithmic/twain_library/assets/1283116/9c18b1a9-c458-4479-b4b8-5837c8c6f859)
To duplicate the scenario:
In other words, the following short code snippet should describe this:
What will happen is that the Plustek user interface will fail to enable the "Exit" button on their interface after the pages have been scanned, thus there is no way, other than killing the task using the Task Manager, to exit the application. This should not be the case, as the driver knows that the scan count is 0 (after debugging this was confirmed), so the driver should have enabled the Exit button on the user interface when the single page was scanned.
This behavior from the Plustek scanner only happens if the number of pages scanned will be less than the number of pages in the document feeder, and only when the user interface is shown. Specifying
DTWAIN_ACQUIREALL
or using a page number that is equal or greater to the number of pages in the document feeder, then the user interface works correctly.Testing against an Hewlett-Packard scanner shows no issues -- the scanner properly processes the pages in the feeder if the number of pages scanned is less than the number of pages in the feeder.
The current workaround for this is to always specify DTWAIN_ACQUIREALL as the number of pages to scan, or scan without the user-interface being shown. I will keep this issue opened for the time being, and will close it if there is no easy resolution (if I had access to the Plustek driver source code, it would be a simple fix, but that's life).