Link to home
Start Free TrialLog in
Avatar of Mohammad Alsolaiman
Mohammad AlsolaimanFlag for Saudi Arabia

asked on

Is there any way to launch a scanner via web application?

Hello;
I have small archiving web app C# MVC, and I need to have a button on this page to start a scanner direct, and get the images to store it in my sql database.
Any help please to do so!
Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Dr. Klahn
Dr. Klahn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Define "web application". Is this running on a web server, or is it self-hosted on the client machine? The former is not going to allow you to interact with hardware on the client's machine.
Avatar of Mohammad Alsolaiman

ASKER

it is running on a web server
hmmm ... mayyyyyybe have to use Internet Explorer to achieve this. (Can't believe I just said that). AFAIK, Internet Explorer is the only browser that supports Active-X. Bob or Sue in the accounting department has a check scanner device connected to their PC, which allows them to scan checks directly into the company's bank account. The bank ships you a check scanner and an instruction sheet that says "Step 1: Open Internet Explorer" ... hard to believe but a lot (it not, all?) banks have to resort to IE because they need that functionality of calling the check scanner from the web browser.
It is true that an archiving program has been purchased and it has been shown that the scan button only works with the Internet Explorer. It does not work with Chrome browser. And I was confused what is the problem.
You really don't need to involve Internet Explorer it is just that people tend to take shortcuts. You can implement custom protocol handler for example
oblak:\\startsscanner
and map it to a C# app running / listening for commands coming for this particular protocol handler. The app can then start the scanner, scan the image and upload it to the database of your choice.

This way you can bypass ActiveX requirements. I have done it for a leading bank and a very large telco operator (very sensitive to security) in past. As long as you can convince them to have a custom protocol handler installed and train your end users to accept the "External Protocol Request" warning once (they have to check a checkbox Remember my choice for all links of this type) and you are good to go.

I generally do not like to take content from SO, but here there is an end to end guidance on the same hence https://stackoverflow.com/questions/7087728/custom-protocol-handler-in-chrome

Please note that the implementation shown in above code is VERY crude. I would rather prefer to write my own code with necessary bells and whistles (checks to prevent unauthorized calls and more) and not use that code as it is.

Regards,
Chinmay.
Dr. Klahn, would you please write me a snippet of code shows how to use CGI with
This disk top application that use  IrfanView line command line
Shell ("c:\program files\irfanview\i_view32.exe /batchscan=(InOutGroup,1,1,2,1," & Trim(GetDBPath) & "InOutGroup,jpg,0)")

Open in new window

Because I had search the net about CGI but I couldn't find good article of how to use it with scanners TWAIN.
thanks to all participants for the valuable comments.