WIA通过silverlight,双面扫描

时间:2011-09-23 14:47:30

标签: c# silverlight duplex wia scanning

我正在尝试使用我的Xerox documate 752扫描双面打印的A3页面。我正在使用文档进纸器进行扫描,但只能在侧面进行扫描。我如何访问其他图像?

这是我的基本代码:

dynamic imageFile1;
dynamic imageFile2;
dynamic wiaDialog = AutomationFactory.CreateObject("WIA.CommonDialog");
dynamic Scanner = wiaDialog.ShowSelectDevice(1, false, false);
dynamic manager = AutomationFactory.CreateObject("WIA.DeviceManager");
dynamic deviceInfo = null;
foreach (dynamic info in manager.DeviceInfos)
                        {
                            if (info.DeviceID == Scanner.DeviceID)
                            {
                                deviceInfo = info;
                            }
                        }
          dynamic device = deviceInfo.Connect();

        dynamic item = device.Items[1];
        int dpi = 150;
                   item.Properties["6146"].Value = 2;
            item.Properties["6147"].Value = dpi;
            item.Properties["6148"].Value = dpi;
            item.Properties["6151"].Value = (int)(dpi * _width);
            item.Properties["6152"].Value = (int)(dpi * _height);

     int deviceHandling = 5;//code for both feed (1) + duplex (4) 

                        device.Properties["3088"].Value =  deviceHandling;


                        int handlingStatus = (int)device.Properties["3087"].Value;

                       if (handlingStatus == deviceHandling)
                        {                     
    //scan the file
                            imageFile1 = wiaDialog.ShowTransfer(item, "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}", true);

//get the second image
  imageFile2 = wiaDialog.ShowTransfer(item, "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}", true);
    }

     imageFile1.SaveFile("C:\\testfile1.jpg");
 imageFile2.SaveFile("C:\\testfile1_2.jpg");

从我在其他地方读到的,如果有双面图像,则可以通过再次调用ShowTransfer()来访问它。在我的扫描仪上,这个简单的尝试扫描新文档并返回错误,因为进纸器现在是空的。我从我的handlingStatus返回5表示feed(1)和duplex(4)都已打开 - 或者我完全错了?

非常感谢任何帮助。

0 个答案:

没有答案