问题
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)
回答1:
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)
回答2:
There is a solution called Dynamic Web TWAIN from Dynamsoft which provides a Browser-based TWAIN SDK for acquiring images from TWAIN devices, and editing and saving them to remote databases.
回答3:
As @Basic mentioned, JTwain can be used to create such a solution. In fact, the developer of JTwain has created ScannerJS that allows one to scan directly from browsers like IE, Chrome and Firefox using JavaScript. In order to use it in your web pages, you need:
Include scanner.js:
<html lang="en"><head>
<script src="//asprise.azureedge.net/scannerjs/scanner.js" type="text/javascript"></script>
and call scanner.scan
:
function scanToWebPageAndUploadToWebServer() {
scanner.scan(displayImagesOnPage,
{
"twain_cap_setting": {
"ICAP_PIXELTYPE": "TWPT_GRAY",
"ICAP_XRESOLUTION": "200",
"ICAP_YRESOLUTION": "200"
},
"prompt_scan_more": true,
"discard_blank_pages": "false",
"blank_page_threshold": "0.02",
"output_settings": [
{
"type": "return-base64-thumbnail",
"format": "jpg",
"thumbnail_height": 200
},
{
"type": "upload",
"format": "pdf",
"pdf_force_black_white": "false",
"pdfa_compliant": "false",
"pdf_text_line": "By ${USERNAME} on ${DATETIME}",
"exif": {
"DocumentName": "Doc Scan Powered by Asprise.com",
"UserComment": "Scanned using Asprise software"
},
"upload_target": {
"url": "https://asprise.com/scan/applet/upload.php?action=dump",
"max_retries": 2,
"post_fields": {
"provider": "Asprise"
},
"cookies": "name=Asprise; domain=asprise.com",
"auth": "user:pass",
"headers": [
"Referer: http://asprise.com"
],
"log_file": "null",
"max_operation_time": 600
}
}
]
}
);
}
回答4:
You can use a signed applet, using a library like MMS computing's. You can see it in use in an applet in the codebase of OpenKM.
回答5:
It seems there's a Web API toolkit available for Fujitsu fi series scanners. Its basically an app you install on client machine where the scanner is that accepts calls via JSON or Silverlight and sends them to the scanner drivers.
http://uk.emc.com/enterprise-content-management/captiva/cloud-toolkit.htm
I've just downloaded it and am reading trough the docs, so can't vouch it works.
来源:https://stackoverflow.com/questions/3504231/how-can-i-trigger-a-scanner-from-a-browser