How to view PDF Documents using .Net 2.0 without Adobe Reader Installed.

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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rupesh PCommented:
Response.ContentType = "application/pdf";
 Response.WriteFile(whatever you need)
Karl Heinz KremerCommented:
You cannot include all the necessary DLLs in your program - the ActiveX control is just a method to remote control Acrobat (or Reader), and you need the application to be installed in order to do that. There are no DLLs or controls that you could include to implement that behavior.

I'm not familiar enough with the .NET programming environment to recommend an approach that would load the ActiveX control only on demand, but you can certainly use another 3rd party control to render PDF documents. I would recommend the XPdf Viewer (

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tjw_bldAuthor Commented:
Thanks for the quick replies.

Regarding rupshindia, I am not familiar with ASP.Net, but I think you giving a ASP.Net solution, where I need a WinForms solution.

Regarding khkremer, the XPdf 3rd Party viewer is a possible option, although I'd still like to explore the dynamically loaded dll option.  I will accept your solution and open a new question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.