WIA 2.0 Duplex scanning

坚强是说给别人听的谎言 提交于 2019-12-04 11:16:11
ITD

After a few more hours of searching I found a clue in the following post. https://stackoverflow.com/a/7580686/3641369

As I used a one-pass duplex scanner, both front and back sides where scanned at the same time. By setting the device properties (device properties, not item properties) Document_Handling_Select to 5 (Feeder + Duplex) and Pages to 1 and calling the transfer method 2 times, I finally got the font and back side of the scan.

Setting wiaDev.Properties["Document Handling Select"] = 5 specifies the use of the feeder and scanning duplex.

Setting wiaDev.Properties["Pages"] = 1 specifies that the scanner should keep 1 page in memory, this allowing to keep both front side and back side of the page in memory during 1 scan pass.

if (duplex)
{
     wiaDev.Properties["Document Handling Select"].set_Value(5);
     wiaDev.Properties["Pages"].set_Value(1);
} 

Getting the Wia item and setting item properties such as color and dpi.

var item = wiaDev.Items[1];
item.Properties["6146"].set_Value((int)clr);
item.Properties["6147"].set_Value(dpi);
item.Properties["6148"].set_Value(dpi);

Then calling the transfer method twice returns two different images

var img = (ImageFile)wiaCommonDialog.ShowTransfer(item, FormatID.wiaFormatJPEG);

ImageFile imgduplex = null;
if(duplex)
   imgduplex = (ImageFile)wiaCommonDialog.ShowTransfer(item, FormatID.wiaFormatJPEG);

Hope this helps someone!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!