Closed Nonononoki closed 5 years ago
Hi,
TWAIN version should not matter that much thanks to backwards compatibility. The default TWAIN manager is v1.7 or maybe older, and yet it can handle any current TWAIN drivers (sources) and applications.
What about existing applications like IrfanView - can they use your scanner without issues? Maybe the driver is corrupted or incompatible with Windows 10?
There is the possibility to debug the TWAIN protocol, though it involves modification to your Windows directory:
TWAINDSM.dll
from https://github.com/twain/twain-dsm/tree/master/Releases for Windows, 32 bit (yes 32, not 64).\Windows\twain_32.dll
to e.g. twain_32.dll.old
TWAINDSM.dll
from 1. to \Windows\
and rename it to twain_32.dll
TWAINDSM_LOG
and set its value to e.g. C:\twain.log
C:\twain.log
I did everything you said, but no log files are created at all. Yes, I removed the old .dll and replaced it with the lastest one from the link you provided.
I cannot connect the DS with the twpp classes of this project nor with the ones from the official examples, but strange enough, it works with Twacker, but only if you don't select the TWAIN 2.0 option in the settings.
It looks like the driver is badly written, and does not actually conform to TWAIN specs, as it seems to depend on a specific version of TWAIN manager. This issue should be taken to Ricoh.
TWPP
does work with it if you remove the new TWAIN manager (TWAINDSM.dll
) from your system (C:\Windows
and maybe C:\Windows\SysWOW64
). Or you can force the use of old manager with mgr.load(true)
. Either way, make sure the twain_32.dll
is the original file, not TWAINDSM.dll
in disguise.
Wow, thanks! Using mgr.load(true);
solved the issue for me! :)
@xricht17 Unrelated question, could you maybe tell me on how to save the scanned bitmap as a file on the hard drive?
Since you already use Qt, what about QImage
?
E.g. on Windows:
ImageNativeXfer xfer;
...
auto bmp = xfer.data<BITMAPINFOHEADER>();
QImage img = QImage::fromData(reinterpret_cast<uchar *>(bmp.data()), bmp->biSize + bmp->biSizeImage, "DIB");
img.save("C:\\img.bmp");
I'm very much a beginner regarding TWAIN, so maybe I missed something important.
Unfortunately, the current TWAIN driver of my scanner is stuck at version 1.9. Following the Application development of the readme, I'm stuck at this line of code:
src.open(); // not hard, is it?
which return the result code 1 for failure. Using the default DS and the DS dialog also returns a failure code. Using the official TWAIN example (targeting the TWAIN version 2.1) on github also returns an error on opening the DS. Therefore my guess is that the TWAIN version of my scanners driver is simply too old.
I'm using: Windows 10 Pro 64-bit Qt 5.7 with the Qt Creator MSVC2015 32-bit Ricoh MP C3004