Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2037
  • Last Modified:

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.

0
tjw_bld
Asked:
tjw_bld
1 Solution
 
Rupesh PCommented:
Response.ContentType = "application/pdf";
 Response.WriteFile(whatever you need)
0
 
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 (http://www.glyphandcog.com/XpdfViewer.html).
0
 
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.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now