WIA 通过 silverlight,双面扫描
我正在尝试使用我的 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() 来访问它。在我的扫描仪上,这个简单的尝试扫描新文档并返回错误,因为进纸器现在是空的。我从处理状态中返回 5,表明进纸 (1) 和双面打印 (4) 均已打开 - 还是我完全错了?
任何帮助将不胜感激。
I'm trying to scan an A3 page in duplex using my Xerox documate 752. I'm getting it to scan fine using the document feeder but only on side. How do I access the other image??
Here is my basic code:
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");
From what I've read elsewhere if there is a duplex image you access it by calling the ShowTransfer() again. On my scanner this simple tries to scan a new document and returns an error as the feeder is now empty. I'm getting a 5 returned from my handlingStatus indicating that both feed (1) and duplex (4) are turned on - or have i got this totally wrong?
Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论