dynarithmic / twain_library

Dynarithmic TWAIN Library, Version 5.x
Apache License 2.0
56 stars 24 forks source link

Plustek SmartOffice PS286 user interface issues with the "Exit" button disabled #83

Open dynarithmic opened 8 months ago

dynarithmic commented 8 months ago

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

Grayed/Disabled Exit Button after scanning less pages than the number of pages in the feeder: exitbtn_disabled

To duplicate the scenario:

In other words, the following short code snippet should describe this:

DTWAIN_SOURCE source = DTWAIN_SelectSource(); // select the Plustek Smartoffice PS286
//... Now place more than one page in the document feeder
if ( source )
{
    DTWAIN_AcquireNative(source, DTWAIN_PT_DEFAULT, 1, 1, 0, NULL); // acquire just one page and show the UI
    //... Make sure you do not choose ADF duplex (choose either ADF front side or ADF rear side)
    //...Hit the scan button
}

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).

dynarithmic commented 8 months ago

This issue is related to #81

dynarithmic commented 8 months ago

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.