[英]c# IE Plugin BHO get the pdf
我需要一些IE插件(浏览器帮助器对象)的帮助。
插件应该做什么:
如果用户单击后面带有pdf的链接,则插件应调用计算机上安装的exe文件。 exe文件将检查PDF并打开默认的pdf应用程序或特殊的pdf应用程序。
我做了什么:
我的BHO从我的IE开始。 我最初使用此代码:
http://www.codeproject.com/Articles/19971/How-to-attach-to-Browser-Helper-Object-BHO-with-C
我禁用了所有adobe插件,因此显示了“下载”窗口。 惠特这段代码我可以解析html正文添加html标记等,但这不是我想要做的...
我的问题:
我不知道如何获取PDF。 如果我直接调用pdf下载链接,则将站点对象转换为InternetExplorer或WebBrowser对象失败。
public int SetSite(object site) { if (site != null) { ieInstance = site as InternetExplorer; ieInstance.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete); } else if (ieInstance != null) { ieInstance.DocumentComplete -= new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete); } return 0; }
Document ='(((SHDocVw.InternetExplorer)(ieInstance))。Document'引发了类型为'System.Runtime.InteropServices.COMException'的异常
有人可以告诉我,在IE中出现下载窗口之前,我该如何获取pdf? 我知道下载前会有一个事件,但是这个事件对我没有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.