How Can I Trigger a Scanner from a Browser?

Randy J Parker picture Randy J Parker · Aug 17, 2010 · Viewed 51.7k times · Source

I have Fujitsu fi-6130 TWAIN / ISIS scanners that I'd like to trigger from a button in a jQuery Rails web page. Not only would I like to have the page tell the scanner to "go", I'd also like to upload the resulting file via Paperclip once the (single) page is scanned - ideally without requiring the user to navigate a file explorer widget to find the file manually.

Each scanner is usb attached to a Windows XP desktop, though we may replace these call center desktops with Google Chrome OS.

This question was asked almost a year ago, but mainly received suggestions requiring the use of commercial IE .NET products that cost several hundred dollars - Interfacing with the end-user's scanner from a webapp (web/scanner integration)

Answer

Basic picture Basic · Aug 17, 2010

This isn't possible from directly within a standard HTML/js page - js has no permissions to access peripherals like scanners.

It may well be possible using either flash or silverlight but suspect you'd hit permissions issues. There's articles here and here but it may be a) too involved and b) not quite what you're after.

If you control the machines the web app will be running on, I'd recommend using a simple desktop client to perform the scan and allowing connections to it from within the webpage by opening up a local port

so js does an AJAX call to (say) http://localhost:1234/Services/Scan which returns an image

Edit: With regards to writing the desktop client, you've got a number of options. I'd personally recommend you not try to do this in PERL/PHP as they don't seem to be the right tool for the job and I suspect you'll end up loading COM objects to try and access TWAIN devices (and we all know how much fun that is...)

In the comments, you've indicated you don't like Visual Studio - So if you're familiar with Java, I'd suggest you have a look at JTwain (commercial but seems to be good quality) or start reading here. NB: I'm not a frequent java developer so can't guarantee either of the above is exactly what you need.

Beyond that, I'd suggest C++ using a different IDE (although this wouldn't be OS-agnostic)