How to include a PDF Viewer plugin with a C# .NET app using webbrowser control?
I've have an app that is a xml/xslt driven document viewer. In its current state, a user points their own browser to the xml file and can view the pdf files from menu selections in their browser so long as they have a PDF viewer plugin such as Adobe Reader installed on their machine.
Using the .NET webbrowser control, I was able to create a small little app of m开发者_开发技巧y own that renders the document viewer (the interface, etc) great so I can remove the need for the user to use their own browser. I'd like to take this a step further and remove the need for the user to have the pdf viewer plugin installed on their system and just be able to include the plugin either rolled into the .exe I ship or have it dependent on a locally provided .dll for the plugin.
I've worked before with portable apps (i.e. Firefox) and I know this is possible to have the the portable firefox app use a plugin dll provided in the same directory structure as the portable app.
Is there a way to do this either by forcing the webbrowser control (essentially an instance of IE) reference a locally provided dll for the plugin or by embedded in the plugin somehow?
Thanks for any input.
Contact the plugin's author to see if you can legally redistribute the plugin first. Then ask if the webbrowser control is supported by the plugin. Most likely the plugin is written as an ActiveX Document Server that is not designed for the webbrowser control but if the plugin is written property (that is, not using hacks and undocumented behavior specific to IE) it should work.
You can also write your own Activex document server to handle the PDF files navigation, but it is a lot of work even with MFC's ActiveX document server support. Or you can write a XBAP/Silverlight/Flash based viewer that displays the XML and only convert to PDF when the client want to print/download.
精彩评论