从网络应用程序与最终用户的扫描仪接口(网络/扫描仪集成)
考虑典型文档处理 Web 应用程序中的以下扫描过程:
- 用户使用连接到其计算机的扫描仪扫描文档
- 扫描的图像作为 BMP/JPG/TIF/PNG 文件本地保存在用户计算机上
- 用户点击文件上传 Web 应用程序中的“浏览..”按钮
- 用户将看到一个文件对话框,他/她可以使用该对话框来查找扫描图像
- 用户点击“上传图像”,扫描图像将上传到存储它的服务器
这个过程非常复杂,我想减少步骤数以使该过程更加用户友好/防呆。在理想情况下,上述步骤将被替换为仅一个步骤,即当单击“扫描并上传”时,Web 应用程序会自动触发程序启动文档扫描、完成文档扫描并上传结果图像。不幸的是,“网络/扫描仪集成”的状态似乎很差,所以这可能是乌托邦。
你会如何解决这个问题?更具体地说,您将如何减少所描述的用例中涉及的步骤数量?
Consider the following scanning procedure in a typical document handling webapp:
- The user scans a document using a scanner connected to his/her computer
- The scanned image is saved locally on the user's computer as a BMP/JPG/TIF/PNG file
- The user hits a file upload "Browse.." button in the web application
- The user is presented with a file dialog which he/she uses to locate the scanned image
- The user hits "Upload image" and the scanned image is uploaded to the server where it is stored
This process is quite complicated and I'd like to reduce the number of steps in order to make the process more user friendly/fool proof. Under ideal circumstances the above steps would be replaced with only one step in which the procedure initiate document scanning, complete document scanning and upload resulting image is automatically triggered from the webapp when clicking say "Scan and upload". Unfortunely it seems like the state of "web/scanner integration" is quite poor so this might be utopia.
How would you tackle this problem? More specifically, how would you go about reducing the number steps involve in the use-case described?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
两年过去了,这里为刚刚加入我们的人介绍最新技术。
Dynamsoft 和 Atalasoft 拥有与任何服务器端堆栈兼容的多浏览器网络扫描工具包。两者都要求用户安装 ActiveX(在 IE 中)或 NPAPI 插件(Chrome、Firefox 等)才能通过 TWAIN API 访问扫描仪。
显然,如果您有时间或预算有限,您可以创建自己的插件。我衷心推荐 FireBreath 插件框架和任何 TWAIN 库,而不是编写您自己的 TWAIN代码。
一旦安装了ActiveX或插件,剩下的工作就是javascript和插件的组合。客户端上的 HTML 以及服务器上的某种处理程序来接受和处理传入的图像,这可以使其看起来就像带有附加文件的多部分表单提交。
我建议使用 AJAX 在 javascript 中进行图像上传,因为它是与网页相同的浏览器“会话”的一部分,并且它继承了浏览器的代理设置、会话 cookie 和服务器端身份验证。我不知道Dynamsoft的控件,Atalasoft工具包包括这样的AJAX上传。图像作为 base64 编码字符串从插件传递到 javascript,因此实际上不会创建本地文件。
免责声明:我使用 Atalasoft 的 WingScan 网络扫描工具包。
Well, two years have passed, so here's an update on the state of the art for those just joining us.
Both Dynamsoft and Atalasoft have multi-browser web-scanning toolkits which are compatible with any server-side stack. Both require the user to install an ActiveX (in IE) or an NPAPI plugin (Chrome, Firefox, etc.) to get access to the scanner via the TWAIN API.
Obviously if you have the time or a limited budget, you can create your own plugin. I heartily recommend the FireBreath plugin framework, and any TWAIN library rather than writing your own TWAIN code.
Once the ActiveX or plugin is installed, the rest of the work is a combination of javascript & HTML on the client, and some kind of handler on the server to accept and process the incoming image, which can be made to look just like a multipart form submit with an attached file.
I recommend doing the image upload in javascript using AJAX, because it is then part of the same browser 'session' as the web page, and it inherits the browser's proxy settings, session cookies and server-side authentication. I don't know about Dynamsoft's control, the Atalasoft toolkit includes such AJAX uploading. The image(s) are handed from the plugin to the javascript as a base64-encoded string, so no local file is actually created.
Disclaimer: I work on Atalasoft's WingScan web-scanning toolkit.
如果您的目标受众运行的是 Windows 和 IE,并且您不介意花几美元,Atalasoft 有一些能够满足您需求的组件。
If your target audience is running Windows and IE, and you don't mind spending a few $$, Atalasoft has some components that will do just what you're looking for.
我实际上看到银行有人在设置我的帐户时这样做,我感到非常惊讶。有问题的银行使用的是 Windows 和 IE,我假设您处于同样受控的环境中。我认为银行使用了自定义/可预测的扫描仪驱动程序和 ActiveX 控件的组合。
加载的页面显示“打开扫描仪”,工作人员将文档弹出并点击网页上的“扫描”,然后页面更改为“扫描”,然后在网页上显示扫描的文档以供工作人员批准。我只能假设扫描仪驱动程序将图像发送到某个位置,并且 Active X 控件正在轮询它的出现,一旦出现,它就会在屏幕上显示图像,一旦工作人员批准了它,Active X 就会将其上传到背景。她打开下一页并继续剩下的过程。
天知道他们是如何让所有这些技术发挥作用的,但这是可以做到的。
I actually saw someone at the bank do this while setting up my account and I was totally amazed. Bank in question was using Windows and IE, I assume your in an equally controlled environment. I think the bank used a combination of a custom/ predictable scanner driver and an ActiveX control.
A page loaded which said "Open the scanner" the staff member popped the document in and hit Scan on the webpage, then the page changed to say Scanning, then it showed the scanned document on the web page for the staff member to Approve. I can only assume that the scanner driver send the image to a certain location and the active X control was polling for it to appear, once it appeared it showed the image on screen, once the staff member had approved it the active x uploaded it in the background. She opened the next page and carried on with the rest of the process.
God knows how they made all that tech work but it can be done.
Silverlight 4 即将推出。它应该能够与用户计算机上的 COM 对象进行交互(前提是它们运行的是 Windows)。理论上,您可以从 Silverlight 网页调用 WIA 方法。
Silverlight 4 is coming out soon. It is supposed to have the ability to interact with COM objects on the user's computer (provided they are running Windows). In theory you call WIA methods from your Silverlight web page.
我们实施了一个解决方案来为银行实施远程存款。它仅适用于 IE。创建了一个与 LeadTools TWAIN dll 交互的 winforms dll。 Leadtools TWAIN dll 抽象了所有 TWAIN 细节。此方法比使用 ActiveX 控件稍好一些。客户端需要.NET Framework。扫描的图像被发送回页面上的隐藏变量并在服务器上进行处理。
We implemented a solution to implement Remote Deposit for a bank. It works only in IE. A winforms dll was created that interfaces with LeadTools TWAIN dll. Leadtools TWAIN dll abstracts all the TWAIN minutae. This approach is slighly better than using an ActiveX control. .NET Framework would be needed on client. The scanned images are posted back to a hidden variable on the page and are processed on the server.
嗯,我一直想在使用扫描文件之前查看它,但我想这取决于您的扫描仪以及您需要的质量。
如果目标是“自动化扫描和上传过程”而不是“编写网络应用程序”,我会编写一个 AutoIt 脚本来控制现有的扫描仪软件和一个简单的 ftp 程序。
Hmm, I've always wanted to look at a scanned file before I did anything with it, but I suppose that depends on your scanner and how much quality you need.
If the goal is to "automate the scanning and uploading process" as opposed to "write a web app", I'd write an AutoIt script to control the existing scanner software and a simple ftp program.
最有可能删除大多数步骤的选项可能是编写一个自定义的扫描实用程序,用户可以下载该实用程序并在本地计算机上运行。
SANE 或 TWAIN 将处理获取扫描图像。 cURL 可以处理将图像上传到您的网络应用程序。为了让最终用户更轻松,我会使用 Comet 连接之类的东西在文件可用时更新网页。
如果这不是一个选项,您可以查看用户使用扫描仪软件时可能有哪些选项。我相信现在很多程序都支持扫描到电子邮件或FTP。
我用于 Intranet 应用程序的解决方案是使用多功能扫描仪/复印机扫描到 Web 服务器有权访问的 SMB 共享。用户只需使用复印机扫描到共享,当他们回到办公桌时,他们会转到新的扫描页面,其中显示所有新的未处理文件的列表。
The option most likely to remove the most steps, would probably be writing a customized scan utility that the user would download and run on their local machine.
SANE or TWAIN would handle getting the scanned image. cURL could than handle uploading the image to your web app. To make things even easier for the end user, I would use something like a Comet connection to update the web page when the file was available.
If that isn't an option, you might look into seeing what options your users will likely have using their scanners software. I believe many programs now support scanning to email or ftp.
The solution I have used for an intranet app, using multifunction scanner/copiers was to scan to an SMB share that the web server had access to. The user just goes to the copier scans to the share and when they get back to their desk, they go to the new scans page which shows a list of all the new unprocessed files.
由于您的受众是受控环境,您可以基于 WIA/TWAIN 编写自己的浏览器扩展/程序来执行扫描。如果您选择BHO/ActiveX/XPCOM等浏览器扩展,您需要获得用户的许可才能安装您的扩展。如果您选择编写程序,您可能需要像 ClickOnce 或 Java Web Start 这样的 Web 部署技术才能从 Web 启动。
在 Windows 上连接 TWAIN 是一件痛苦的事。除了复杂性之外,您还必须显示由不同扫描仪驱动程序开发人员编写的一些 GUI。它可能是支持旧扫描仪或未通过其他接口公开的功能(例如来自文档进纸器的全速多页扫描)的唯一方法。
Microsoft 的 WIA 通过脚本对象模型使与扫描仪的接口变得更加容易,但是扫描仪特定的功能不可用,并且一些旧扫描仪不支持该接口。
扫描完成后,您可以调用Web服务来通知服务器,并且网页可以定期刷新以检查新图像。
Since your audience is controlled environment, You can write your own browser extension/program based on WIA/TWAIN that does the scanning. If you choose browser extensions such as BHO/ActiveX/XPCOM, etc, you need get the user's permission to install your extension. If you choose to write a program you may need web deployment technologies like ClickOnce or Java Web Start to be launched from web.
Interfacing TWAIN is a pain on Windows. Complexity aside, you have to display some GUI written by different scanner driver developers. It may be the only way to support old scanners or features not exposed via other interfaces like full-speed multipage scans from a document feeder.
Microsoft's WIA makes interfacing with scanner much easier with a scripting object model, however scanner-specific features are not available and some old scanners do not support the interface.
After scanning you can call a web service to notify the server and the web page can refresh periodically to check new images.
我们也做过类似的事情。我们使用了命令行 TWAIN 程序 (http://www.burrotech.com/quickscan.php)。 $$ $49
1) 我们开发了一个小型 .Net 应用程序来将 QuickScan 程序作为 shell 命令运行。
2) 该命令已分配给扫描按钮。
3) 一旦用户按下扫描按钮,就会出现输入文件名的提示。用户将交易Id保存为文件名。
4) 另一个 .Net 应用程序(或者可能与前面提到的相同)将读取此文件并将其上传到数据库,考虑到文件名是事务 ID。
工作就像黄油中的热刀!
您可以尝试在 IE 中显示交易 ID,用户选择 ID,然后按“扫描”。您的应用程序将读取所选文本并使用所选文本作为文件名保存文件。我们还没有尝试过,但应该可以。
We have done something similar. we used a command-line TWAIN program (http://www.burrotech.com/quickscan.php). $$ $49
1) We developed a small .Net application to run the QuickScan program as a shell command.
2) The command was assigned to the Scan button.
3) Once the user presses on the scan button, a prompt will appear to enter the file name. The user saves the transaction Id as the file name.
4) Another .Net application (or maybe the same mentioned before) will read this file and upload it into database considering that the filename is the transaction ID.
Worked like a warm knife in butter!
You can try displaying the transaction ID into IE, user to select the ID then presses Scan. Your application will read the SELECTED text and save the file using the SELECTED text as the file name. We havne't tried it but it should work.
如果您认为 Web 应用程序仅限于 Web 浏览器,那只是乌托邦,事实上,除了 HTML 和 Javascript 之外,Web 应用程序还可以包含许多不同的技术。
解决该问题的一个很酷的方法(事实上,我已经将其用于某些 USB 串行设备)是使用 SOAP+XMPP 来实现您的应用程序。您可以在 Perl 中使用 XML::CompileX::Transport::SOAPXMPP、Catalyst::Engine::XMPP2、Catalyst::Controller::SOAP 和 Catalyst::Model::SOAP 来完成此操作。
使用 XMPP 的有趣之处在于它简化了寻址管理,因为您使用 JID (Jabber ID) 来查找软件代理,而不是某些主机+端口寻址模式。使用XMPP的第二个有趣的部分是更容易地支持服务器向客户端推送信息。
但是,如果您不想处理 XMPP,您仍然可以使用轻量级嵌入式 http 服务器(Perl 中的 HTTP::Server::Simple)做同样的事情,并以某种方式在服务器中注册当前扫描仪地址,以便它可以打回来。
最后一个选项(不太可爱)是让软件代理轮询服务器以查看何时存在针对该特定机器的“扫描文档并上传”命令,并在存在该命令时实现该操作。
总之,只要您使用 XML、SOAP 等 Web 标准来执行通信,拥有本地软件代理来与本地硬件交互并不会让您的 Web 应用程序变得不那么“Web”。
It is only utopia if you think that web applications are limited to web browsers, in fact, web applications can include a lot of different technologies, besides HTML and Javascript.
The cool way of solving that problem -- in fact, I already used that for some usbserial devices -- is to implement your application using SOAP+XMPP. You can do that in Perl by using XML::CompileX::Transport::SOAPXMPP, Catalyst::Engine::XMPP2, Catalyst::Controller::SOAP and Catalyst::Model::SOAP.
The interesting thing about using XMPP is that it simplifies the management of addressing, since you use the JID (Jabber ID) to look for the software agent, not some host+port addressing schema. The second interesting part of using XMPP is to more easily support the server pushing information to the client.
But if you don't want to handle XMPP you still can do the same thing with a lightweight embedded http server -- HTTP::Server::Simple, in Perl -- and somehow register the current scanner address in the server so it can call back.
And a last option, which is not so cute, is to have the software agent polling the server to see when there is a "scan document and upload" order for that specific machine and realize that operation when that is present.
In summary, having a local software agent to interact with the local hardware doesn't make your webapp less "web", as long as you use web standards -- like XML, SOAP and others -- to perform that communication.
您可以在您的网站中放置一个 Java 小程序。这可以访问扫描仪并通过 REST 将数据发送到您的 Web 服务器。
You can put a Java applet in your website. This can access the scanner and send the data via REST to your web server.