【问题标题】:WIA set document size to scan C#WIA 设置文档大小以扫描 C#
【发布时间】:2011-12-18 16:20:38
【问题描述】:

我正在使用 WIA 扫描文档。一切正常,但扫描页面结果不是 A4 格式。怎么说WIA扫描整个文件?当我扫描时,页面结果被裁剪为 Letter 格式。 这是代码:

 WIA.Item Item = _scannerDevice.Items[1] as WIA.Item;
 WIA.ImageFile wiaImage = null;
 Item.Properties["6147"].set_Value(dpi);
 Item.Properties["6148"].set_Value(dpi);
 //start from x=0; y=0;
 Item.Properties["6149"].set_Value(0);
 Item.Properties["6150"].set_Value(0);

 Item.Properties["6151"].set_Value(width);
 Item.Properties["6152"].set_Value(height);
 wiaImage = (ImageFile)_scannDialog.ShowTransfer(Item, wiaFormatJPEG, false);                      
 if (wiaImage.FileData != null)
   {
       WIA.Vector vector = wiaImage.FileData;
      _image = Image.FromStream(new MemoryStream((byte[])vector.get_BinaryData()));
       OnScannComplete(_image);
  }

【问题讨论】:

    标签: c# .net wpf com wia


    【解决方案1】:

    我怀疑您需要为页面大小使用适当的属性。

    您需要将 WIA_IPS_PAGE_SIZE (ID 3097) 设置为 0(表示 A4)。

    有关将页面大小设置为 A4 的一些示例/来源,请参阅:

    【讨论】:

    • 我已经尝试过制作这个 Item.Properties["3097"].set_Value(0);但它不起作用。你能告诉我怎么做吗?
    • 目前不在我的开发机器上...你对 widthheight 有什么价值?还阅读特别是。我发布的最后一个链接。
    • 最后一个链接不工作。我收到异常“值不在预期范围内”。在最后一个 else if 表达式中。
    • 现在我有 dpi = 150、width=1275 和 height=1750。它正在工作,但文件太大
    • “文件太大”是什么意思?
    猜你喜欢
    • 2011-04-05
    • 2011-01-15
    • 2018-03-09
    • 2017-05-05
    • 1970-01-01
    • 1970-01-01
    • 2018-04-27
    • 2023-03-11
    • 2016-05-08
    相关资源
    最近更新 更多