WIA 2.0 Duplex scanning

杀马特。学长 韩版系。学妹 提交于 2020-01-11 03:30:07

问题


Since Vista, Windows is shipped with WIA 2.0 (wiaaut.dll). According to the following KB article and many of my findings on various forums, duplex scanning is no longer possible using WIA 2.0. Yet, the article mentions the use of native WIA 2.0, what would make duplex scanning possible. (https://support.microsoft.com/en-us/kb/2709992)

According to the WIA 2.0 documentation (https://msdn.microsoft.com/en-us/library/windows/desktop/ms630196(v=vs.85).aspx), duplex scanning is possible but using the new WIA_IPS_DOCUMENT_HANDLING_SELECT (3088) property.

My issues are:

  • I have no idea how to use native WIA, I suspect when using C# its just not possible.
  • I cant find a way to set the new WIA_IPS_DOCUMENT_HANDLING_SELECT property, as the property is not present in my wiaDevice properties. According to WiaDef.h, its property id is still 3088 and the only possible value is 0x400 (1024).

If anyone could help me (and I think many others) out on this, it would be much appreciated!

Greetings,

M.


回答1:


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!



来源:https://stackoverflow.com/questions/30743888/wia-2-0-duplex-scanning

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