-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On a scanner with an automatic document feeder, if the message notification is turned on and a paper jam occurs during the scanning process, the DTWAIN_TN_PAGEFAILED code will be received, but the message notification callback keeps being called #54
Comments
Please note that the language that should be used in the Issues section should be English. If I translate the text to English, I see this:
|
Thank you for your reply. The log is: Question 2: |
As a test, in the Python program, try this:
The It looks like the driver does not reset itself on a paper jam, and maybe the only way to reset the driver is to probably close the source using DTWAIN_CloseSource() and reopen it again. This is just a guess, and I would need the scanner in-house to really test this. Since I do not have the scanner available, there is only one place in the source code where DTWAIN sends out the DTWAIN_TN_PAGEFAILED, and that is after an attempt of scanning the page is done, so this is relatively simple to figure out if you build the source code. If this is an option, let me know and I will guide you as to where to look in the code. |
The
Change the code to:
,after scanning the first page, a paper jam occurred while scanning the second page,the DTWAIN_TN_PAGEFAILED notification received four times,Received DTWAIN_TN_QUERYPAGEDISCARD notification only after all page scans were completed,but I don't know why.I want to scan a page and obtain an image. What should I do?I have read the code for this library,I couldn't find the location to handle the callback return value,can you tell me? |
I made some changes to the DTWAIN_TN_PAGEFAILED notification and placed them in the development branch. Please try the development DLL's available here for 32-bit and here for 64bit. As to the location of where the DTWAIN_TN_PAGEFAILED is issued, it is here. |
Also, I highly suggest that you not attempt anything after the paper jam, as the behavior is highly dependent on how your driver handles paper jams when something occurs. In the case of a paper jam that occurs after many pages have been scanned successfully, I suggest you use DTWAIN_SetMultipageScanMode and specify you want to save the pages when the source is closed. This way, you will still have the pages that scanned successfully saved to the multipage file when the source or source UI is closed. As stated on the help page: by default, DTWAIN will not save image files if the acquisition has been canceled by the user, application, or TWAIN driver. This can also be overridden by DTWAIN_SetMultipageScanMode. Also, I suggest you attempt this with the UI on, not off, and see exactly what the UI of the device does when a paper jam occurs. Right now, you are not sure of the feedback when a jam occurs by running with the UI turned off. |
我不确定我的解决方案是否合理,甚至看着有点粗暴,但是确实解决消息通知回调被不停的调用问题,我在DTWAIN_TN_PAGEFAILED回调代码中使用DTWAIN_EnableMsgNotify(0)把消息通知关掉了,在下一次进行扫描时打开。另外我使用的语言是python
The text was updated successfully, but these errors were encountered: