JAVA 的 TWAIN/WIA 实现
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15893046/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
TWAIN/WIA implementation for JAVA
提问by Mo3z
I am working on an application(Java Applet) that interacts with scanner. I understand I need a Twain library or WIA library to make it work in windows. But I am not sure what are the differences of two? I am trying to use this library:
我正在开发一个与扫描仪交互的应用程序(Java Applet)。我知道我需要一个 Twain 库或 WIA 库才能使其在 Windows 中工作。但我不确定两者有什么区别?我正在尝试使用这个库:
JAR file link is broken so I got it from here. http://rsbweb.nih.gov/ij/plugins/twain-scan.html
JAR 文件链接已损坏,因此我从此处获取了它。 http://rsbweb.nih.gov/ij/plugins/twain-scan.html
And DLLs from here: http://sourceforge.net/projects/twain-dsm/?source=dlp
和来自这里的 DLL:http: //sourceforge.net/projects/twain-dsm/?source= dlp
But, it does not detect the source. Here is the error log:
但是,它不检测源。这是错误日志:
I am on 64bit machine. Anybody had any success?
我在 64 位机器上。有人成功过吗?
TWAIN specification is too long to follow and I haven't found any resources on WIA implementation.
TWAIN 规范太长了,我没有找到任何关于 WIA 实现的资源。
Any help/pointers/resources is greatly appreciated.
非常感谢任何帮助/指针/资源。
回答by Jonathan Spiller
Use the same bit mode
使用相同的位模式
For twain device control in java, all components need to be in the same mode.i.e. the JRE, Twain DSM (Source Manager), and the Twain driver (Scanner driver) all need to be 32-bit or all 64-bit.No mixing.
对于java中的twain设备控制,所有组件都需要处于相同的模式。即 JRE、Twain DSM(源管理器)和 Twain 驱动程序(扫描仪驱动程序)都需要为 32 位或全部为 64 位。没有混合。
The default installation of 64-bit Windows contains the 32-bit mode of Twain DSM. And you say you've downloaded the 64-bit DSM. It's likely that the scanner's driver is 32-bit and that is why it cannot be found.
64 位 Windows 的默认安装包含 Twain DSM 的 32 位模式。你说你已经下载了 64 位 DSM。扫描仪的驱动程序可能是 32 位的,这就是找不到它的原因。
You have 2 options:
您有 2 个选择:
Keep it all 64-bit.
保持所有 64 位。
- Use the 64-bit TWAINDSM.DLL.
- Make sure your JRE/JDK is 64-bit.
- Make sure your scanner has a 64-bit driver.
- 使用 64 位 TWAINDSM.DLL。
- 确保您的 JRE/JDK 是 64 位的。
- 确保您的扫描仪具有 64 位驱动程序。
My scanner doesn't have a 64-bit driver available, but I tested a 64-bit configuration using a 64-bit "virtual scanner" and it worked.
我的扫描仪没有可用的 64 位驱动程序,但我使用 64 位“虚拟扫描仪”测试了 64 位配置并且它工作正常。
Keep it all 32-bit (recommended)
全部保持 32 位(推荐)
- Use the 32-bit TWAINDSM.DLL.
- Make sure your JRE/JDK is 32-bit.
- Use the scanner's 32-bit driver (probably default).
- 使用 32 位 TWAINDSM.DLL。
- 确保您的 JRE/JDK 是 32 位的。
- 使用扫描仪的 32 位驱动程序(可能是默认的)。
You can download 32 and 64 bit twain virtual scannershere.
您可以在此处下载 32 位和 64 位twain 虚拟扫描仪。
Note: I mention the JDK because if you're running the code from an IDE it may be pointing to a different JRE to to the system default. True story, happened to me.
注意:我提到 JDK 是因为如果您从 IDE 运行代码,它可能指向与系统默认值不同的 JRE。真实的故事,发生在我身上。