I can only scan one side of the document but not the second side. What are settings I need to achieve both side of scan using Wia Leadtools.
WiaAcquireFlags flags = WiaAcquireFlags.None;
bool showProgress = true;
_progressDlg = new ProgressForm("Transferring", "", 100);
_wiaAcquiring = true;
if (_showUserInterface)
{
flags = WiaAcquireFlags.UseCommonUI | WiaAcquireFlags.ShowUserInterface;
}
else
{
if (SelectAcquireSource() != System.Windows.Forms.DialogResult.OK)
{
_wiaAcquiring = false;
return;
}
}
if (_showUserInterface && _wiaVersion == WiaVersion.Version2)
showProgress = false;
if (showProgress)
_progressDlg.Show();
_wiaSession.AcquireOptions = _wiaAcquireOptions;
_transferMode = (_wiaProperties.DataTransfer.TransferMode == WiaTransferMode.None) ? WiaTransferMode.Memory : _wiaProperties.DataTransfer.TransferMode;
//#if !LEADTOOLS_V19_OR_LATER
System.Windows.Forms.DialogResult dialogResult = _wiaSession.Acquire(mainWindowHandle, _sourceItem, flags);
Updated Code:, I have updated code according to answer of "LEADTOOLS Support" but it is still scanning 1 side of page.
public void Scan()
{
...
...
...
object rootItem = _wiaSession.GetRootItem(null);
if (rootItem != null)
{
wiaSession.EnumItemsEvent += new EventHandler<WiaEnumItemsEventArgs> (wiaSession_EnumItemsEvent);
wiaSession.EnumChildItems(rootItem);
wiaSession.EnumItemsEvent -= new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent);
wiaSession.AcquireOptions = _wiaAcquireOptions;
transferMode = (_wiaProperties.DataTransfer.TransferMode == WiaTransferMode.None) ? WiaTransferMode.Memory : _wiaProperties.DataTransfer.TransferMode;
//#if !LEADTOOLS_V19_OR_LATER
System.Windows.Forms.DialogResult dialogResult = _wiaSession.Acquire(mainWindowHandle, _sourceItem, flags);
...
...
...
}
public void wiaSession_EnumItemsEvent(object sender, WiaEnumItemsEventArgs e)
{
if (e.Item != null)
{
WiaProperties wiaProperties = _wiaSession.GetProperties(e.Item);
if (System.Windows.Forms.MessageBox.Show("Enable duplex?", "WIA test", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
{
wiaProperties.ScanningMode = WiaScanningModeFlags.Feeder | WiaScanningModeFlags.Duplex;
wiaProperties.MaximumNumberOfPages = 2;
}
else
{
wiaProperties.ScanningMode = WiaScanningModeFlags.Feeder | WiaScanningModeFlags.FrontOnly;
wiaProperties.MaximumNumberOfPages = 1;
}
wiaSession.SetProperties(e.Item, wiaProperties);
}
}
Note:
- I have debugged the code and it sets properties in wiaSession_EnumItemsEvent
- When it asks from "Enable duplex", I click YES
- Added screenshot of debugging code for setting properties
- I have 1 sheet of paper in the feeder that I want to scan from both sides