-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Recently, when I scanned with this product, I found that the first scan was successful and there was no problem. However, in the second scan, there were serious problems. I searched for a long time, but I could not solve them,I simulate a web project in the example below. When the scan is finished, sleep for 5 seconds and start the scan again
public class TwainExample implements ScannerListener {
static TwainExample app;
Scanner scanner;
public TwainExample() throws ScannerIOException {
scanner = Scanner.getDevice();
scanner.addListener(this);
scanner.acquire();
}
public void update(ScannerIOMetadata.Type type, ScannerIOMetadata metadata) {
if (type.equals(ScannerIOMetadata.ACQUIRED)) {
System.out.println("Have an image now!");
} else if (type.equals(ScannerIOMetadata.NEGOTIATE)) {
ScannerDevice device = metadata.getDevice();
try {
device.setShowUserInterface(false);
device.setShowProgressBar(true);
device.setResolution(100);
} catch (Exception e) {
e.printStackTrace();
}
} else if (type.equals(ScannerIOMetadata.STATECHANGE)) {
System.err.println("current state"+metadata.getStateStr());
if (metadata.isFinished()) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("sleep done restart my job");
try {
scanner.acquire();
} catch (ScannerIOException e) {
e.printStackTrace();
}
}
} else if (type.equals(ScannerIOMetadata.EXCEPTION)) {
metadata.getException().printStackTrace();
}
}
//The error log is as follows
uk.co.mmscomputing.device.twain.TwainIOException: uk.co.mmscomputing.device.twai
n.TwainScanner.setException:
jtwain: EXCEPTION 0xC00000FD thrown in twain source or source manager.
This may have left the twain subsystem in an unstable state.
Please restart application or web-browser.
at uk.co.mmscomputing.device.twain.TwainScanner.signalException(TwainSca
nner.java:131)
at uk.co.mmscomputing.device.twain.jtwain.signalException(jtwain.java:28
7)
at uk.co.mmscomputing.device.twain.jtwain.cbexecute(jtwain.java:243)
at uk.co.mmscomputing.device.twain.jtwain.nstart(Native Method)
at uk.co.mmscomputing.device.twain.jtwain.access$200(jtwain.java:12)
at uk.co.mmscomputing.device.twain.jtwain$1.run(jtwain.java:338)
uk.co.mmscomputing.device.twain.TwainException: jtwain: EXCEPTION 0xC00000FD thr
own in twain source or source manager.
This may have left the twain subsystem in an unstable state.
Please restart application or web-browser.
at uk.co.mmscomputing.device.twain.jtwain.ncallSourceManager(Native Meth
od)
at uk.co.mmscomputing.device.twain.jtwain.callSourceManager(jtwain.java:
104)
at uk.co.mmscomputing.device.twain.TwainSourceManager.call(TwainSourceMa
nager.java:24)
at uk.co.mmscomputing.device.twain.TwainIdentity.open(TwainIdentity.java
:70)
at uk.co.mmscomputing.device.twain.TwainSource.open(TwainSource.java:99)
at uk.co.mmscomputing.device.twain.TwainSourceManager.openSource(TwainSo
urceManager.java:93)
at uk.co.mmscomputing.device.twain.jtwain.cbexecute(jtwain.java:234)
at uk.co.mmscomputing.device.twain.jtwain.nstart(Native Method)
at uk.co.mmscomputing.device.twain.jtwain.access$200(jtwain.java:12)
at uk.co.mmscomputing.device.twain.jtwain$1.run(jtwain.java:338)
//This question has puzzled me for a long time