我正在尝试从进纸器扫描几页,尽管当我调用 ShowTransfer 函数时扫描仪会自动扫描所有页面(不使用循环),但我只返回第一页。
我究竟做错了什么?
这是我的代码:
WIA.Item item = device.Items[1] as WIA.Item;
if (pages > 1)
{
// Set to feeder
SetWIAProperty(device.Properties, 44, 1);
}
SetWIAProperty(device.Properties, WIA_DEVICE_PROPERTY_PAGES_ID, 1);
AdjustScannerSettings(item, 150, 0, 0, 1250, 1700, 0, 0, 1);
try
{
// scan image
WIA.ICommonDialog wiaCommonDialog = new WIA.CommonDialog();
WIA.ImageFile image = (WIA.ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatBMP, false);
// save to temp file
string fileName = Path.GetTempFileName();
File.Delete(fileName);
image.SaveFile(fileName);
image = null;
// add file to output list
images.Add(Image.FromFile(fileName));
}
catch (Exception exc)
{
throw exc; …Run Code Online (Sandbox Code Playgroud) 我正在使用 C# 开发一个应用程序来使用 WIA 2.0 库。目前我可以使用大部分功能,例如 ADF(自动文档进纸器)、过滤器等等。
现在,我需要使用扫描仪(富士通)的双面打印器。
我正在尝试将 WIA_DPS_DOCUMENT_HANDLING_SELECT 扫描仪属性设置为 DUPLEX 值。请参阅下面的代码:
try
{
bool hasMorePages = false;
//determine if there are any more pages waiting
Property documentHandlingSelect = null;
Property documentHandlingStatus = null;
foreach (Property prop in WiaDev.Properties)
{
if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_SELECT)
documentHandlingSelect = prop;
if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_STATUS)
documentHandlingStatus = prop;
}
object obj = new object();
obj = (WIA_DPS_DOCUMENT_HANDLING_SELECT.DUPLEX);
documentHandlingSelect.set_Value(ref obj);
if (documentHandlingSelect != null) //may not exist on flatbed scanner but required for feeder …Run Code Online (Sandbox Code Playgroud)