dynarithmic / twain_library

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

launch scan without any user interface #88

Open yannickModulo opened 7 months ago

yannickModulo commented 7 months ago

Hi, I need to start a scan without any gui and user interaction. I have tried with modless flag but it still open a windows before starting the scanner to setup the scan. I have tried with two different models and it's the same for both. (Windows application). Is there a way to disable any user interface and directly launch the scan?

dynarithmic commented 7 months ago

1) What model is the scanner?

2) The UI is controlled by the scanner driver. A request to not show the UI is a request -- there is no guarantee that the driver will honor the request.

3) Did you try the DTWDEMO.exe program and see if that works with your scanner?

yannickModulo commented 7 months ago

Hi,

thanks I have found the correct flag to disable UI. It works fine with my all in one printer samsung. but I have an issue with the CZUR ET18. It always open a window with a previewx and with a "scanner" button to trigger the scan :( and I need to use this scanner, not the samsung.

dynarithmic commented 7 months ago

If you used the same program to turn off the UI in the Samsung printer, but that same program does not work for the CZUR ET18, then this indicates that the manufacturer may not have this feature enabled.

You can try to call DTWAIN_EnableIndicator and set the flag to FALSE. See if that makes a difference.

Other than that, there are a few things you can do to verify if this is the case of the manufacturer not allowing scanning without the UI:

1) Call DTWAIN_IsUIControllable and inspect the return value. If it is FALSE, then this means that the UI cannot be controlled, i.e. turned off. If the return value is TRUE, then this may mean that there is a problem with the driver not reporting the correct information.

or

2) Generate a full TWAIN log (DTWAIN_SetTwainLog) and inspect the call tree when you call the DTWAIN_Acquire function. At some point, DTWAIN will request that the UI not be set (in the DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS triplet with the TW_USERINTERFACE.ShowUI set to FALSE). It may be hard to find, but doing a search in the log for MSG_ENABLEDS will get you to the point in the log where this is taking place.

or

3) Try another program that does not use DTWAIN (like the Twacker program, either Twack_32.exe or Twack_64.exe, depending on whether the device is 32-bit or 64-bit). If Twacker fails to turn off the UI, then this definitely means that the UI cannot be turned off.

Note that if the TWAIN driver is supposed to be compliant with TWAIN specification 1.9, then the scanner must support the ability to scan without a UI. If the scanner is TWAIN compliant to 1.8, then the requirement isn't mandated.