How to display a pdf file in asp.net web-form

I'm looking for a free way or .Net component to display PDF files in the browser and allow for printing of the files also. What methods/components/libraries can do this, and what guidance do you have on the problem in general.

asked Feb 22, 2011 at 20:59 3,497 21 21 gold badges 76 76 silver badges 119 119 bronze badges Quite a broad question, don't you think? Commented Feb 22, 2011 at 21:02

PDF are actually loaded in browser using browser plugins. Are you looking for a control that parses the PDF in the server side and load the content inside an IFrame, may be ?

Commented Feb 22, 2011 at 21:03

Could look in to using Google Docs. Pass the PDF to google and have it to the PDF->HTML for you, though this is hacky at-best. PDFs exist for portability, I don't see why your client wouldn't have support for one of the most versatile document formats around.

Commented Feb 22, 2011 at 21:04 @Oded- Absolutely. Its a broad problem. Commented Feb 22, 2011 at 21:28

@Brad Christie- Yes, PDFs stand for portable document format, but I need to be able to display the pdf's in a browser with database information displayed as well. If I can easily embed a viewer into my asp.net page, I would consider that an option.

Commented Feb 22, 2011 at 21:29

6 Answers 6

I think you might look into this :

The code will help you load the PDF as html in your document.

1 1 1 silver badge answered Feb 22, 2011 at 21:08 2,982 24 24 silver badges 38 38 bronze badges

Did what I was looking for. A control that can display a pdf in the browser on a web form, with other elements on the page, and whose pdf file source can be changed by server-side code.

answered Feb 23, 2011 at 18:45 3,497 21 21 gold badges 76 76 silver badges 119 119 bronze badges

If you don't want to display as PDF on the client, you have some options. Basically, most of your options revolve around converting the documenting to something else the user can use:

So why can't you rely on a PDF viewer?

answered Feb 22, 2011 at 21:10 15.7k 2 2 gold badges 33 33 silver badges 59 59 bronze badges

Its not that I can't rely on a PDF viewer, its more than I want the pdf to be visible within a webform that will have other content visible as well.

Commented Feb 22, 2011 at 21:37

Possibly, can I change which pdf file is loaded there easily from code? Do you know of any good tutorials on how to do it this way?

Commented Feb 22, 2011 at 22:10 It's pretty straightforward: Just generate an Commented Feb 22, 2011 at 22:55 Yes - it's trivial: geekswithblogs.net/ranganh/archive/2005/04/25/37635.aspx Commented Feb 28, 2011 at 13:48

There are flash apps available to do this. e.g. whatever http://issuu.com/ is using.

answered Feb 22, 2011 at 21:17 4,842 1 1 gold badge 27 27 silver badges 25 25 bronze badges

Even with converting PDF to HTML or IMAGE you will not get the same quality or something near to the original document. It's more than bunch of texts and images with PDF .

If your clients cannot support most famous document format (portable document format -> pdf), then you need to think about the design again.

answered Feb 22, 2011 at 21:22 30.6k 43 43 gold badges 145 145 silver badges 210 210 bronze badges

You can do it by using this project which is based on Microsoft Silverlight framework.

In the mentioned project there are two cases:

  1. Blend Visually - used to output a PDF in
  1. Data exchange between Silverlight and PDF (input/output from/to PDF)

I did not personally tested this particular project but I found this site good and reliable for .NET solutions.