How to view PDF Documents using .Net 2.0 without Adobe Reader Installed.
Posted on 2008-11-12
We have a program that can view images of many types, some standard (JPEG, TIFF, etc) and some proprietary. We would like to add the ability to view PDF documents as well. As they select a new image, we select the correct viewer and view the image right in our application inside a WinForm (we set Visible = true for the correct viewer and Visible = false for the rest of them). Therefore we would like to view PDF images inside our application (not launch Adobe Viewer).
I have been able to get this to work by including AxInterop.AcroPDFLib.dll and Interop.AcroPDFLib.dll and using an axAcroPDF1 viewer.
The problem is that all of the people who use this application do not need PDF documents and do not have Adobe Reader installed. However if you try to run the newly built program that includes these Adobe dlls and Adobe is not installed, it crashes on startup ("has encountered a problem and needs to close"), even if they do not navigate to the screen that needs the pdf viewer.
Is there any way that we can only attempt to load the Adobe dll's dynamically if they attempt to view a PDF docuemnt so that those who do not have Adobe installed and do not view PDF documents do not need to install it? Or alternately, is there a way we can include all of the required dll's with our program so that anyone can view PDF documents even if they do not have Adobe Reader installed. We do not need a fully functional reader, just a simple viewer.