要访问WIA,您需要添加对COM库“Microsoft Windows Image Acquisition Library v2.0”(wiaaut.dll)的引用。 添加“使用WIA;”
const string wiaFormatJPEG = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}";
CommonDialogClass wiaDiag = new CommonDialogClass();
WIA.ImageFile wiaImage = null;
wiaImage = wiaDiag.ShowAcquireImage(
WiaDeviceType.UnspecifiedDeviceType,
WiaImageIntent.GrayscaleIntent,
WiaImageBias.MaximizeQuality,
wiaFormatJPEG, true, true, false);
WIA.Vector vector = wiaImage.FileData;
(System.Drawing中)
Image i = Image.FromStream(new MemoryStream((byte[])vector.get_BinaryData()));
i.Save(filename)
这就是一个基本方式,可与我的平板/文档进纸。如果你一次只需要一个以上的文档/页面,那么可能有更好的方法来做到这一点(从我所能看到的情况来看,这只能处理一张图片,尽管我不完全确定)。虽然它是WIA v1文档,但Scott Hanselman的Coding4Fun article on WIA确实包含了一些关于如何为多个页面执行此操作的更多信息,我认为(我还没有比我自己更进一步)
如果它适用于无纸办公系统,您可能还需要查看MODI(Office Document Imaging)为您执行所有OCR。
快速的问题。你绝对需要WIA吗?或者你可以和吐温一起过吗?如果吐温还好,我可能会有一些代码要捐献。 – 2008-08-12 15:48:18