最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Image scanning through browser - Stack Overflow

programmeradmin4浏览0评论

Here's the problem: I have a usb scanner (HP) and want to get the image through a web application. Solved long ago with a java applet but now chrome doesn't support them anymore.

I've already seen potential solutions. The "coolest" one was Dynamsoft but I can't afford on NPAPI or ActiveX. I've seen html5 websocket technology, the munication works but it seems that there are no way to interface it with the scanner.

Here's the problem: I have a usb scanner (HP) and want to get the image through a web application. Solved long ago with a java applet but now chrome doesn't support them anymore.

I've already seen potential solutions. The "coolest" one was Dynamsoft but I can't afford on NPAPI or ActiveX. I've seen html5 websocket technology, the munication works but it seems that there are no way to interface it with the scanner.

Share Improve this question edited Jan 2, 2017 at 9:36 Sebas 21.5k9 gold badges59 silver badges109 bronze badges asked Aug 27, 2015 at 14:48 Federico LucaFederico Luca 431 silver badge4 bronze badges 1
  • This is Rachel from Dynamsoft. Along with ActiveX and NPAPI editions, Dynamic Web TWAIN also es with HTML5 edition to support the latest versions of Chrome and Firefox on Windows and Mac OS X. Besides the price on our website, we also provide some more flexible licensing options which might suit your needs. Please contact sales[@]dynamsoft. for more details. – Rachel Commented Aug 28, 2015 at 9:05
Add a ment  | 

2 Answers 2

Reset to default 5

I'm in a similar boat. Firefox has announced deprecation as well but has not yet set a date for end of support. Your only other option in the near future is to write your own plugin based on PNACL. I've made attempts at this and found it difficult due to PNACL limiting C source's functionality. If using Dynamsoft's products you'll want to use their Web TWAIN SDK which would cover most users, but again their price can be an issue.

In the future we might have some things to look forward to:

  • chrome.documentScan - only for Chrome OS, let's hope they port it back to Windows!
  • WebUSB - drivers in Javascript, not my cup o' tea
  • TWAIN Direct - driverless scanning, will not work with older scanners

I've got some workaround idea. It's not using NPAPI plugin so it will be patible with modern browsers.

User must download and run installer. This installer contains some scanner software (patible with most scanners) with support for mand line and software to uploading files by FTP I use NASP2 (support most modern scanners) to scan and WINSCP to upload by ftp (we need only winscp.exe amd winscp. files). I put WINSCP files to NASP2 folder.

Our installer create bat file ScanToMyWebsite.bat in NASP2 folder, something like:

@echo off
echo Scanning, please wait...
"C:\Program Files\NAPS2\NAPS2.Console"  -f  -o "%appdata%/NAPS2/temp/my_scan.pdf"
echo Uploading scan...
winscp. /mand "open ftp://login:password@our_ftp_server.pl" "put  ""%appdata%\NAPS2\temp\my_scan.pdf""" "exit"
echo Done!

This bat file just scan document and upload it to ftp server.

Then our installer register new protocol in system - for example "scan-to-my-website:" (it's like http:, ftp: etc.) by exec .reg file (our installer do this):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\scan-to-my-website]
@="URL:scan-to-my-website Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\scan-to-my-website\DefaultIcon]
@="C:\\Program Files (x86)\\NAPS2\\NAPS2.exe"

[HKEY_CLASSES_ROOT\scan-to-my-website\Shell]

[HKEY_CLASSES_ROOT\scan-to-my-website\Shell\Open]

[HKEY_CLASSES_ROOT\scan-to-my-website\Shell\Open\mand]
@="\"C:\\Program Files\\NAPS2\\ScanToMyWebsite.cmd\""

Now we can create in our website

<a href="scan-to-my-website:">Scan!</a>

After click on this link it just run bat file which we created and upload scan to ftp server. By AJAX or any other method website can check is file has been uploaded. That's it :)

发布评论

评论列表(0)

  1. 暂无评论