Can one listen a twain (Maybe WIA) scanner?

2019-05-01 01:07发布

问题:

I am evaluating VintaSoft .net control and Atalasoft DotTwain Image Capture. And I am very but very lost with the most of the definitions and keywords.

So I am asking this because I think I am in Lala land. Is it possible to listen or have the scanner tell my app that there is a scanned image and I can process it?

The idea is to have a winservice that is waiting for the scanner to scan something and when that happens process the image.

回答1:

I have only worked with the native interfaces to TWAIN and WIA, so I can't vouch for these other layers on top of them. However, with regards to TWAIN, some mechanisms do exist that allow an application to be notified to capture data. I believe this is handled with STI.dll, an older library that is available on Windows 2000+. Look up StiCreateInstance for more info.

If you choose to go the WIA route, it is much simpler. You can register to recieve events, such as a 'scan' button or 'image created' event. Then all you need to do is handle those events to get the image. The toughest part of that is finding hardware that implements the features you want.

Microsoft has a WIA automation library that makes many of these tasks much simpler. It can be used by scripting languages.



回答2:

We've recently incorporated TWAIN into one of our apps. We looked at WIA but in the end TWAIN is much more flexible and can connect to apps such as VRS (Virtual ReScan). In the end it's 'pull', you request a scan and then wait for the scanner. One of the nice things with VRS is that it's software between our TWAIN calls and the device, as such, it takes care of a few things, one of which is it will can wait, virtually forever, for paper to be placed in the hopper for scanning. This allows the ability to 'start' a scan job and then wait for the paper, it also allows for additional pages to be added to the unit.

If you are looking for something a little more 'push' oriented then look to a scanner or MFP that supports ftp/smb/email etc. and let it scan and you can simply monitor a folder or POP3 mailbox for the job.

You can also look to MFP devices that include (sometimes at additional cost) tools to help such as Xerox's Template, Lexmark's LDSS, HP's DSS.

Here is a link to the .NET TWAIN code we based our scanner integration with: http://www.codeproject.com/KB/dotnet/twaindotnet.aspx



回答3:

[edit - if it was me, I'd look at adzm's answer ;-p]

As I understand it, regular TWAIN is a "pull", not a "push" from the scanner. I could well be wrong...

I expect such interfaces do exist for high end, high volume scanners (you know, the ones the size of a billiard table) - but not (AFAIK) for regular consumer scanners.

For use with .NET (and before that, COM), I've always managed with ImageMan.



回答4:

It is possible to have the scanner tell your app that there is a scanned image. I am not familiar with VintaSoft .net control and Atalasoft DotTwain Image Capture, but with some twain sdks, there is OnPostTransfer/OnPostAllTransfer event which is triggered after each scanning so that you can "notify" your winservice