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.
-
1Quite a broad question, don't you think? – Oded Feb 22 '11 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 ? – abhishek Feb 22 '11 at 21:03
-
2Could 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. – Brad Christie Feb 22 '11 at 21:04
-
@Oded- Absolutely. Its a broad problem. – MAW74656 Feb 22 '11 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. – MAW74656 Feb 22 '11 at 21:29
6 Answers
I think you might look into this :
how to convert PDF into HTML using C#
The code will help you load the PDF as html in your document.
http://www.beansoftware.com/ASP.NET-Tutorials/PDF-View-Custom-Control.aspx
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.

- 3,449
- 21
- 71
- 118
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:
- HTML
- RTF (most people can view / print that with client software)
- You could always use software to convert that to a set of images, but this is pretty processor intensive and would require the user to print these out invidually.
- Convert to xps, but that would require that xps be installed on the client's machines.
So why can't you rely on a PDF viewer?

- 15,461
- 2
- 32
- 59
-
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. – MAW74656 Feb 22 '11 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? – MAW74656 Feb 22 '11 at 22:10
-
1It's pretty straightforward: Just generate an tag. Here's page that describes it in more detail: http://www.w3schools.com/TAGS/tag_iframe.asp – RQDQ Feb 22 '11 at 22:55
-
1Yes - it's trivial: http://geekswithblogs.net/ranganh/archive/2005/04/25/37635.aspx – RQDQ Feb 28 '11 at 13:48
There are flash apps available to do this. e.g. whatever http://issuu.com/ is using.

- 4,754
- 1
- 26
- 23
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.

- 29,931
- 42
- 140
- 205
You can do it by using this project which is based on Microsoft Silverlight framework.
In the mentioned project there are two cases:
- Blend Visually - used to output a PDF in
- Create the positioning
div
- Create
iframe
and position/size it - Calling
mqzJsCalls.moveHTMLZone(x,y,w,h)
from the Silverlight User Control - Load PDF into
iframe
- Data exchange between Silverlight and PDF (input/output from/to PDF)
- Setting up the message handler and the
hostContainer
- Expose scriptable object from managed code
- PDF notifies the host that it's ready
- Host sends data to PDF
- Host notifies the PDF it needs user data
- PDF sends the user data to the host
I did not personally tested this particular project but I found this site good and reliable for .NET solutions.

- 5,172
- 34
- 67
- 113