Skip to content
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

scanner continues scanning few more pages even after stopping by setting CancelAll to false in TransferReady #28

Open
miroshnandaa opened this issue May 4, 2022 · 3 comments

Comments

@miroshnandaa
Copy link

I am stopping the scanning by the below code

_twain.TransferReady += (s, ev) => { ev.CancelAll = true; };

this stops the data transfer but still the scanner feeder takes few more pages from Scanner device without sending it to driver.

Is there any way to stop the feeder quickly ?

@soukoku
Copy link
Owner

soukoku commented May 4, 2022

I may have hidden things too well so this call was not made public. Maybe I can expose it in the event.

@miroshnandaa
Copy link
Author

miroshnandaa commented May 5, 2022

hi @soukoku,
that will be great if you can expose it in the event.
If you can tell me when you are planning to do it then it will be really really helpful for me

@jidesheng6
Copy link

I think you can set the number of scans with the CapXferCount property, -1 for continuous scanning and any value for the number of scans and the scanner will stop feeding paper; but for a duplex scanner you need to set it to single-sided scanning mode first, for example my code is as follows:

//set scan number
                if (TwainScanNumberSet.Text != string.Empty && Int32.TryParse(TwainScanNumberSet.Text, out int TwainScanNumberSetInt))
                {
                    if(dataSource.Capabilities.CapXferCount.CanSet)
                    {
                        if(TwainScanNumberSetInt > 0)
                        {
                            //set single scan mode
                            if (dataSource.Capabilities.CapDuplex.IsSupported && !(DoubleScanBox.Checked))
                            {
                                dataSource.Capabilities.CapDuplexEnabled.SetValue(BoolType.False);
                            }
                            dataSource.Capabilities.CapXferCount.SetValue(TwainScanNumberSetInt);
                        }
                        else
                        {
                            dataSource.Capabilities.CapXferCount.SetValue(-1);
                        }
                    }
                }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants