ntwain
ntwain copied to clipboard
scanner continues scanning few more pages even after stopping by setting CancelAll to false in TransferReady
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 ?
I may have hidden things too well so this call was not made public. Maybe I can expose it in the event.
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
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);
}
}
}