问题描述
我需要将pdf文件呈现给webbrowser控件,例如呈现方式.问题是,我需要从webbrowser控件中获取pdf文件的内容.我该怎么做?请帮助.
I need to render pdf file to a webbrowser control like how ie render it. question is, i need to get the content of the pdf file from the webbrowser control. how can i do it? help please.
吉普
推荐答案
由于IE在用户的客户端计算机上嵌入了针对pdf文件类型注册的任何程序,因此没有标准的访问方式.如果打算编写自己的PDF查看器,建议您在文档对象上实现IObjectSafety和IPersistFile.然后,您可以通过IWebBrowser2 :: get_Document获取PDF文档的自动化界面,并使用IPersistFile保存它.
Because IE embed whatever program is registered for the pdf file type on the user's client computer, there is no standard way you can access the document. If you plan to write your own PDF viewer, I suggest you to implement IObjectSafety and IPersistFile on your document object. Then you can you can get the PDF's document's automation interface via IWebBrowser2::get_Document and use IPersistFile to save it.
大多数PDF查看器提供的脚本编写(例如打印)功能都不安全,因此您很少会看到可通过IWebBrowser2 :: get_Document访问的PDF查看器.
Most PDF viewers offer features that are not safe for scripting (e.g. printing), so you would rarely see a PDF viewer accessible via IWebBrowser2::get_Document.
这篇关于在C#中使用Webbrowser控件阅读pdf内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!