Open jaidan22 opened 8 months ago
The following code snippet is from TransferLogic.cs
file
// some poorly written scanner drivers return failures on EndXfer, so also check for the pending count now.
// this may break with other sources but we'll see
if (//pending.Count == 0 &&
session.State > 5)
{
session.ChangeState(5, true);
session.DisableSource();
}
Why is pending.Count == 0
commented? Could this be the reason behind this error?
Hi @jaidan22 , I encountered the same issue when using the HP scanjet 2000 scanner with ADF. I comment "//pending.Count == 0 &&" off, and test again. There is still only the first page returned to the application. May I ask if you have resolved it? If it's resolved, can you tell me how it was resolved?
No. It hasn't been resolved yet.
I edited the source code file that name "NTwain\Internals\TransferLogic.cs". I replaced the line “rc = session.DGControl.PendingXfers.Get(pending);” with code snippet below:
ReturnCode rc = ReturnCode.Failure;
if (session.CurrentSource.Identity.ProductName.IndexOf("scanjet", StringComparison.OrdinalIgnoreCase) > -1 || session.CurrentSource.Identity.ProductName.IndexOf("HP", StringComparison.OrdinalIgnoreCase) > -1)
{
rc = ReturnCode.Success;
}
else
{
rc = session.DGControl.PendingXfers.Get(pending);
}
I compiled on x86 architecture and tried again. The HP scanjet 2000 scanner seemed to work ok for ADF. But I compiled on x64 architecture and tried again. The HP scanjet 2000 scanner seemed not to work good for ADF. Advice to use on x86 architecture. Good luck!
Hello,
I am also facing the same issue with HP Scan Jet Pro 2600 f1 ( Twain 2.4) and HP Pro M478f-9f TW (Twain 2.1).
I added debug statements inside Internals\TransferLogic.cs file in DoTransferRoutine() function and figured out that rc = session.DGControl.PendingXfers.EndXfer(pending); returns pending.count as 0 after first page is scanned even though there are more pages in the ADF.
When pending.count =0 , the below while statement fails and execution comes out of this while responsible for scanning multiple pages from ADF. while (rc == ReturnCode.Success && pending.Count != 0 && !session.CloseDSRequested);
This means session.DGControl.PendingXfers.EndXfer(pending) is not returning the correct value of pending.
Any help will be highly appreciated.
Thanks.
Hello,
I printed all capabilities. Out of all capabilities in the list, "ICapPhysicalHeight: 122" and "ICapFrames: L=0, T=0, R=8.5, B=122" caught my attention. The page length is coming as 122 inches. According to HP user manual, 8.5 by 122 inches is an Extra Long Page Size, and, "Only one page can be scanned when using a long or extra long page setting". I think this is why I am not able to scan more than one page.
I changed the page length through SupportedSizes = USLetter. I again printed the list of all capabilities. Now "ICapPhysicalHeight: 122" and "ICapFrames: L=0, T=0, R=8.266663, B=11.67999". But still I am not able to scan more than one page.
If "ICapPhysicalHeight: 122" restricting me from scanning more than one page, why is HP Twain driver sending Physical width as 122 ?
Any Suggestions.
Thanks
Hi all,
I seem to be running into similar issues to what has been described in previous comments on this thread, just figured I'd share what I've observed so far.
NOTE: I tested Jaidan22's "fix image scanning pending count #64 " pull request against the NTwain sample solutions and that resolves the below issues I'm seeing.
I've been running into issues with the HP ScanJet Pro 2000 s2 scanner which is exhibiting the following behaviour:
I've tried debugging (both in my application and in the NTwain sample projects) and the Visual Studio debugger abruptly dies after stepping past a call to Source.Open() (I've only seen this when using this HP TWAIN source). I've had to run logging against live instances of my application or detach the debugger in order to observe the above behaviour.
Any suggestions or advice on a way forward would be appreciated.
Thanks,
Josh
Hi @soukoku ,
I am currently using an HP LaserJet Pro printer with an ADF. While using the TWAIN driver, I issue encountered was - only the first page is returned to the application, even though all pages pass through the feeder. Interestingly, when I switch to the WIA Driver, everything works as expected, and all pages are returned.
The sample project are also showing the same behavior. However, when I tested an alternate package, it worked fine. Based on this, it seems less likely that the scanner itself is the problem.
Below are the capability values: