Detecting pape out with auto scan
Detecting pape out with auto scan
Hi Loic,
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):
While image_ID<>0
image1.AcquiretoGDPictureImage
image1.SaveAsTiff('test.'&str(counter))
counter=counter+1
End while
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
image1.AcquiretoGDPictureImage
image1.SaveAsTiff('test.'&str(counter))
counter=counter+1
bfeederloaded=image1.IsFeederLoaded
End while
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?
Thanks,
Heard
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):
While image_ID<>0
image1.AcquiretoGDPictureImage
image1.SaveAsTiff('test.'&str(counter))
counter=counter+1
End while
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
image1.AcquiretoGDPictureImage
image1.SaveAsTiff('test.'&str(counter))
counter=counter+1
bfeederloaded=image1.IsFeederLoaded
End while
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?
Thanks,
Heard
Re: Detecting pape out with auto scan/pending xfer
Hi Loic,
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?
Thanks,
Heard
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?
Thanks,
Heard
Re: Detecting pape out with auto scan
Hi Heard,
What are you trying to do with the code you gave me ?
Loïc
What are you trying to do with the code you gave me ?
Loïc
Re: Detecting pape out with auto scan
Hi Loic,
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.
Thanks,
Heard
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.
Thanks,
Heard
Re: Detecting pape out with auto scan
Ok Heard, thanks.
Could you give me the complete code you are using to acquire all the document feeder content ?
Best regards,
Loïc
Could you give me the complete code you are using to acquire all the document feeder content ?
Best regards,
Loïc
Re: Detecting pape out with auto scan
Loic,
Here you go, along with a twainlog.
Heard
Here you go, along with a twainlog.
Heard
- Attachments
-
- loic.zip
- (570.98 KiB) Downloaded 490 times
Re: Detecting pape out with auto scan
Heard, I just need the source code you are using for scanning.
You already gave me a portion but I need to know what twain functions you called before scanning...
IE:
Loïc
You already gave me a portion but I need to know what twain functions you called before scanning...
IE:
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
Loïc
Re: Detecting pape out with auto scan
Ok. Sorry.
setcurrentpixeltype(0)
sethideUI(true)
setcurrentresolution(200)
setduplex(false)
selectfeeder(true)
setautoscan(true)
setpapersize(3)
disableautosourceclose(true)
Heard
setcurrentpixeltype(0)
sethideUI(true)
setcurrentresolution(200)
setduplex(false)
selectfeeder(true)
setautoscan(true)
setpapersize(3)
disableautosourceclose(true)
Heard
Re: Detecting pape out with auto scan
Heard,
I need all the TWAIN code you use. From the source openning to the source closing.
Without that I can't help you...
Loïc
I need all the TWAIN code you use. From the source openning to the source closing.
Without that I can't help you...
Loïc
Re: Detecting pape out with auto scan
Ok Loic. As you know, I do not program in Visual Basic.
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.
Heard
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.
Heard
Re: Detecting pape out with auto scan
No problem Heard,
you can give me your code into your environment language.
However, I maybe understood your issue.
You are using
Are you sure you need this ?
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:
Hope this help.
Loïc
you can give me your code into your environment language.
However, I maybe understood your issue.
You are using
Code: Select all
DisableAutoSourceClose(true)
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.
Loïc
Re: Detecting pape out with auto scan
Ok, Loic,
Here you go.
twainsourcename=image.TwainGetDefaultSourceName
opensourcesucces=image.TwainOpenDefaultSource(twainsourcename)
If opensourcesuccess,
image.TwainSetHideUI(true)
image.TwainSetCurrentResolution(200)
image.TwainEnableDuplex(false)
image.TwainSelectFeeder(true)
image.TwainSetAutoScan(true)
image.TwainSetPaperSize(3)
image.TwainDisableAutoSourceClose(true)
endif
v.cap_item_type=image.TwainGetCapItemType(1)
image_ID=999
breturn=false
totalpages=0
while image_ID<>0 and not(breturn)
image.AcquireToGdPictureImage(image_ID)
If image_ID<>0 and image_ID<>999
totalpages=totalpages+1
image.SaveAsTiff(‘c:\test’&str(totalpages))
image.CloseNativeImage
breturn=image.GetCapCurrentNumeric(cap_item_type,cap_xfer_count)
endif
endwhile
image.TwainCloseSource
Thanks,
Heard
Here you go.
twainsourcename=image.TwainGetDefaultSourceName
opensourcesucces=image.TwainOpenDefaultSource(twainsourcename)
If opensourcesuccess,
image.TwainSetHideUI(true)
image.TwainSetCurrentResolution(200)
image.TwainEnableDuplex(false)
image.TwainSelectFeeder(true)
image.TwainSetAutoScan(true)
image.TwainSetPaperSize(3)
image.TwainDisableAutoSourceClose(true)
endif
v.cap_item_type=image.TwainGetCapItemType(1)
image_ID=999
breturn=false
totalpages=0
while image_ID<>0 and not(breturn)
image.AcquireToGdPictureImage(image_ID)
If image_ID<>0 and image_ID<>999
totalpages=totalpages+1
image.SaveAsTiff(‘c:\test’&str(totalpages))
image.CloseNativeImage
breturn=image.GetCapCurrentNumeric(cap_item_type,cap_xfer_count)
endif
endwhile
image.TwainCloseSource
Thanks,
Heard
Re: Detecting pape out with auto scan
Heard,
Check my previous post. It solve your problem.
Loïc
Check my previous post. It solve your problem.
Loïc
Re: Detecting pape out with auto scan
Loic,
I didn't see your response until after I posted that last code. Let me look at that a while.
Thanks,
Heard
I didn't see your response until after I posted that last code. Let me look at that a while.
Thanks,
Heard
Re: Detecting pape out with auto scan
Hi Loic,
You are excellent! That fixed my problem. I knew it should be simple but could not figure it out.
Thank you!
Heard
You are excellent! That fixed my problem. I knew it should be simple but could not figure it out.
Thank you!
Heard
Who is online
Users browsing this forum: No registered users and 1 guest