Skip to content

Embedding a PDF Document into a HTML page

by werner on October 8th, 2008

Using Adobe’s Acrobat Reader plugin, PDF documents can be embedded into HTML pages using the <embed>-element. An excellent description about this can be found in a blog on Adobe’s web site.

This works for most browsers, but not for all. Especially Firefox 3 on Mac OS X is not supportet (yet).

As a workaround, I am developing a Java Applet, which can be used as a fallback.

I have already drawn the design of the user interface for my Applet. Here is a screenshot from Fireworks, showing a draft of the design on the right, and the graphical segments used by the applet marked in green on the left:

EmbedPDF Fireworks Artwork

I have also implemented a very first prototype of the applet, which you can try out on my web site.

The applet uses the PDF-Renderer library from Sun Microsystems. This library does a good job at rendering PDF documents progressively. Unfortunately, its incomplete in various ways. For example, it can’t read CMYK-images, encrypted documents, and has problems with some Postscript fonts. Maybe I can compensate the missing functionality by borrowing code from the Multivalent PDF library.

From → Java

  1. jaime permalink

    hi werner, your applet is a very good work, there isn’t many viewers to embed a pdf document in a html page,

    i downloaded your code and i’m trying to implement a rotate function and i did it, but when i try to show the rotated page, i only see a blank page…

    i don’t know if in this place i can make this question, but i didn’t found another place… thankyou for your time and if you can help me i really appreciated this.


    pd: sorry for my english

  2. Hi Jaime,

    In order to support page rotation, several classes of the applet need to be changed. I can do this in a couple of hours.

    If you send me a bottle of wine, I’ll create a new release of the applet which provides this functionality.


    btw. your English is absolutely fine!

  3. Hi Jaime,

    I have now added a rotate button to the applet.


Comments are closed.