Can you tell me how to detect a paper out condition when I'm using auto scan?
I'm trying to eliminate the dialog box that comes up when the scanner runs out of paper, but I think the 'scan ahead' feature of the auto scan is causing me some problems.
Here is essentially what I want to do (partial code):
If I runs this code, I get the 'Feeder is out of paper message' from TWAIN.
So I tried to do this:
While image_ID<>0 and bfeederloaded
This code gets rid of my message, but it only saves the first image to disk. I beleive this is because the 'IsFeederLoaded' is being checked before the transfer is complete and thus, before the file is written.
How do I get around this?
I have been working on this some while reading the TWAIN spec.
It looks like I need to be able to tell if there are any pending transfers and if so, stay in the loop.
How can I do this?
What I'm tryihng to do is to have a loop running that acquires the images. When the feeder runs out of paper, I don't want TWAIN to complain and issue a message saying 'Retry or Cancel'. My users won't like that.
This works fine if I don't use auto scan. But if I use autoscan, I will get the message because the feeder runs out of paper and TWAIN issues the message BEFORE my code can check for paper out. This is happening because there are pending transfers, I believe.
I have since modified my code to check XferCount and I got it to work, but I don't really think this is what XferCount is supposed to be used for. I think I need to check for pending transfers, but I don't know how to do that with gdpicturepro.
So to make it clear, I want the user to be able to stack 10 page of paper in the feeder and start scanning with autoscan turned on. When the feeder runs out of paper, I don't want any messages from TWAIN about being out of paper.
You already gave me a portion but I need to know what twain functions you called before scanning...
Code: Select all
image1.SetAutoFeed(True) While image_ID<>0 and bfeederloaded image1.AcquiretoGDPictureImage image1.SaveAsTiff('test.'&str(counter)) counter=counter+1 bfeederloaded=image1.IsFeederLoaded End while
I have given you all the code and a log file generated as it runs, but I will try to convert it into VB for you.
This will take me a while. But I'll post it here.
you can give me your code into your environment language.
However, I maybe understood your issue.
You are using
Code: Select all
I think your problem will gone away if you remove this call.
Else, if you really want to get the source always open you have to check the Twain state like that:
Code: Select all
Dim Counter As Long Counter = 0 Imaging1.TwainSelectSource Imaging1.TwainOpenDefaultSource Imaging1.TwainSetCurrentPixelType (0) Imaging1.TwainSetHideUI (True) Imaging1.TwainSetCurrentResolution (200) Imaging1.TwainEnableDuplex (False) Imaging1.TwainSelectFeeder (True) Imaging1.TwainSetAutoScan (True) Imaging1.TwainSetPaperSize (3) Imaging1.TwainDisableAutoSourceClose (True) While Imaging1.TwainGetState > 5 Or Counter = 0 Imaging1.TwainAcquireToGdPictureImage Call Imaging1.SaveAsTIFF("test" & Str(Counter) & "tif") Counter = Counter + 1 Imaging1.CloseNativeImage Wend
Hope this help.
Here you go.
while image_ID<>0 and not(breturn)
If image_ID<>0 and image_ID<>999
Who is online
Users browsing this forum: No registered users and 2 guests