USB Scanner with Flex / Java applet?

痴心易碎 提交于 2019-12-18 03:43:56

问题


Is there a way to get an image from a usb scanner (on Windows primarily, cross-platform solution would be best) and post the image together to a form in browser with Flex or Java applet?

thx!


回答1:


The standardized TWAIN scanning interface is definitely the place for you to look at, rather than low-level USB, except if you are targeting only one specific device and know how to talk to it.

Java based

There is another Stack Overflow question pointing out a link to a open Applet talking to a TWAIN device. If you're looking to spend no money, and build it yourself, that is maybe a starting point.

The only ready-made commercial product on the market that I can see is JTwain. I don't have any TWAIN devices handy to test, but it looks good.

TWAIN seems be on its way to Linux as well, and the makers of the commercial product promise support for other platforms in the future.

Active X / Plugin-based

There is at least one product connecting Twain on a Windows-only, ActiveX/Browser plugin basis, claiming to support all major browsers. A 30-day trial version is available.




回答2:


Well, to access a USB device from Flex or Java, you'd need a library / API that offers access to USB.

Unfortunately, neither Flex nor Java have an API that supports USB devices in their standard JDK.

There is a USB API for Java, developed under JSR 80:

http://javax-usb.org/

It is not ( yet?) part of the JDK, but it is standardized. Unfortunately, there are only implementations for Linux and BSD. You might be able to use that. See also using java and usb: Which api? jsr-80, jusb, ...? .

That said, you might want to consider other options. Maybe you can write a small wrapper program to do the scanning, and have the applet invoke that? Signed Java applets can invoke native software on the system.

Or just let people specify a directory to read images from (again possible if a Java applet is signed), then have people use the regular scanner software to scan to that directory. You could even poll the directory, so the applet picks up the image automatically...



来源:https://stackoverflow.com/questions/1955855/usb-scanner-with-flex-java-applet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!