5

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.

ITD
  • 303
  • 2
  • 10
  • If possible, I'd recommend you use [TWAIN protocol](twain.org) instead. Compared to WIA, TWAIN provides more customized options and advanced control over the imaging devices. Learn more on [using TWAIN in .NET Applications](http://www.dynamsoft.com/blog/document-imaging/using-twain-in-net-applications/) – Rachel Jun 15 '15 at 05:53

1 Answers1

12

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!

Community
  • 1
  • 1
ITD
  • 303
  • 2
  • 10
  • 4
    Can I ask how did you determine what the values for Feeder and Duplex are? When I try to set Document Handling Select to anything other than 1, its unable to set the property and yet I know this scanner can do double-sided single pass scans in other programs. When I set it to 5 I get "Value does not fall within expected range." I set pages to 1. – Smurfie Mar 30 '16 at 23:49