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
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:
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
}
}
]
}
);
}