-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hello,
I am trying to the high level Java API but I cannot make it work consistently (my program is often stuck in the TwainSource.acquire()method). The target device is an Epson Perfection V600 but in my local development environment I am using the TWAIN2 sample DS.
The DTWDEMO.exe always works flawlessly so I suspect the problems are in the Java API or the JNI layer.
Here are some of the problems I encountered:
- Acquiring a PDF file
With DTWDEMO: twain_pdf_demo.log
Running PDFDemo.java: twain_pdf_jni.log
When I click on "Scan" the UI becomes stuck. I cannot close it by clicking on "Cancel".
There are a lot of errors and exceptions in the JNI log.
I also found these strange values in the log:
TW_MEMREF is TW_IMAGELAYOUT:
{
Frame=0,0-0,0
DocmentNumber=4294967295
PageNumber=4294967295
FrameNumber=4294967295
}
[2024-08-30 11:45:06] Thread [23412] Output: return code from DSM=1 (TWRC_FAILURE)
I noticed that the TW_FRAME.isFrameValid() method inacurrately returns true when all values are set to 0, because of the comparison with Double.MIN_VALUE:

If I define a frame size (ts.getAcquireCharacteristics().getPagesSupportOptions().getFrame().setRight(6).setBottom(10);) then it looks like the acquisition goes further but it does not complete too: twain_pdf_jni+frame.log
=> It seems impossible to acquire a file (even a simple BMP with TinyApplication.java)
- Acquiring to buffer
I am able to run the BufferAcquisitionDemo.java demo, however if I add a logger and enable it with twainSession.enableLogging(true) then the program stays stuck in the acquire method: twain_buf_jni+logging.log
Now if I disable logging just before calling acquire the demo works correctly: twain_buf_jni+notlogging.log
=> It is possible to acquire to buffer, but not if I collect logs
- With the EPSON V600
I have not been able to make a lot of tests yet, but I noticed that:
- When I try to add a logger, the source does not open (somestimes error -1039, sometimes I see this error log: https://github.com/dynarithmic/twain_library_source/blob/53a5e00d087464c3be7b6cf26f6a705b7adfbe6c/source/h/arrayfactory.h#L147)
- A black line appears at the top of the scanned images using AcquireType.BUFFER (there is no such thing when I use the EPSON Scan driver directly). Maybe this is linked to the fact that I added
ac.getPagesSupportOptions().getFrame().setLeft(0).setTop(0).setRight(8.3).setBottom(11.7);to scan an A4 paper (not setting the frame resulted in an error).