views:

652

answers:

7

We want to display a pdf-file on a webpage. From what i can think of i see two possible solutions, displaying the file with some kind of pdf reader(maybe in flash?) or converting the pdf-file to html before displaying it.

How would you proceed to solve a problem like this? Which would be the preferable method?

+11  A: 

Well, there's always a third way: serve the PDF itself and leave the rest to the visitor.

Milen A. Radev
A: 

Check out http://pdfmenot.com/tools/ for code to embed pdfs into your website. It's free.

Brian
that actually looks pretty slick, if you're not bothered with using a third party service (hosted elsewhere) :)
Erik van Brakel
Oh, just noticed, that IS a flash based solution though. Still, very nice.
Erik van Brakel
A: 

Personally I wouldn't bother with that, and just rely on the user to have a proper pdf reader. If you go for a flash (or silverlight?) solution, you're imposing another requirement to the user to cover up the first one. On the other hand, converting PDF to HTML isn't all that easy, just look at how the output from Gmail's 'view as html' functionality looks.

As said, and as others already posted while I'm writing this I am sure, is to not bother and just let the visitor deal with having something to read pdf with ;-)

Erik van Brakel
+2  A: 

For public websites, you can improve the user experience and reduce bandwidth overhead by embedding your PDF documents in your pages using one of the document sharing services such as:

http://www.scribd.com

http://www.docstoc.com

I should also add that scribd also has an API for uploading documents (and more).

runako
A: 

A solution not mentioned by others is to rasterize the PDF (say, via ghostscript) and serve the resulting image as PNG, JPG, etc. You have to choose the resolution (perhaps 72 dpi) and you have to understand that the document will become much less readable, especially to sensory impaired visitors.

Chris Dolan
A: 

If you absolutely need to display the PDF in the browser, you can use FlashPaper. It installs on Windows as a printer, and lets you convert any kind of document to SWF, which you embed in your HTML.

I've used it in several projects, but it's not an ideal solution. From the user standpoint, the best thing is to be able to download the PDF and read it with her favorite PDF viewer.

+1  A: 

Try using the embed or object html tags.

http://blog.flashcolony.com/?p=244

Brian