1

我正在编写一个程序来通过 WIA 使用网络扫描仪。仅扫描一页时一切正常。当我打开进纸器时:

foreach (WIA.Property deviceProperty in wia.Properties)
{
    if (deviceProperty.Name == "Document Handling Select")
    {
        int value = duplex ? 0x004 : 0x001;
        deviceProperty.set_Value(value);
    }
}

程序接收到扫描信号,表明进纸器中仍有文档,并因 com 错误而脱落(扫描仪继续扫描)。这是检查进纸器中页面的代码:

//determine if there are any more pages waiting
Property documentHandlingSelect = null;
Property documentHandlingStatus = null;

foreach (Property prop in wia.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;
}

if ((Convert.ToUInt32(documentHandlingSelect.get_Value()) & 0x00000001) != 0)
{
    return ((Convert.ToUInt32(documentHandlingStatus.get_Value()) & 0x00000001) != 0);
}

return false;

获取图片代码:

imgFile = (ImageFile)WiaCommonDialog.ShowTransfer(item, wiaFormatJPEG, false);

遗憾的是找不到使用 WIA WSD 的示例。也许有一些设置可以通过 WSD 获取多个图像。

4

1 回答 1

0

我在使用带有 vba 的 WIA 2.0 来控制 Brother MFC-5895CW 多功能扫描仪时遇到了几乎相同的问题。当我从 ADF 转移扫描件时,我无法将超过 2 张图片捕捉到图像对象(我可能尝试了所有现有的选项,并且在这个问题上工作了几天和几个小时!)我发现使用该扫描仪的唯一解决方案是使用WIA.CommonDialog-Object 的 ShowAcquisitionWizard 方法将所有扫描的文件批量传输到指定文件夹。对我来说,这更像是一种解决方法,而不是令人满意的解决方案,因为后处理会变得更加复杂。

令人惊讶的是,我在客户端的整洁扫描仪上尝试了相同的程序... ShowAcquisitionWizard 仅将一个扫描页面发送到指定文件夹,其他页面消失了。令我惊讶的是,使用“CommonDialog.ShowTransfer”方法,我能够将所有扫描的文档一张一张地传输到我的应用程序中的图像对象中。

于 2012-02-25T20:18:21.363 回答