Title: Embedding PDFs on your site
Topic: HowTo
EPUB (for mobile devices) Standalone HTML (printer-friendly) XeLaTeX source plain text source Source files with attachments View history

The easy way

If you need to embed a PDF found on the library or elsewhere, and you want just a simple snippet of HTML code, add to the HTML code of the page:

<object width="400" height="500" type="application/pdf" data="http://URL-TO-PDF" id="pdf_content_a">
    <p>Insert your error message here, if the PDF cannot be displayed.
    I suggest you to insert the link to the pdf</p>
</object>

Change the proper data attribute to the actual link, change the id attribute to one to suite your need, if you want to style it with CSS, or wrap the whole snippet with a <div class="embed_pdf"> </div>. If you don't know what I'm talking about, stop reading, as you don't look like a "webmaster".

The final user should have a proper PDF-reader plugin installed, or Acrobat, or Mozplugger for Firefox, or something like that. If not, the message between <p> will be displayed.

The fancy, Flash-based, solution

Assuming everyone has the flashplayer installed (not granted, as it's crap), and you want a fancy solution, this is the how-to.

Use swftools

Go to http://www.swftools.org/download.html, download and install swftools.

Download your pdf. Then run:

pdf2swf -bl -o document.swf document.pdf

Then upload the resulting document.swf to the server, and add the following code to the page (edit it to suite your needs)

<object
 width="419"
 height="595"
 codebase="http://active.macromedia.com/flash5/cabs/swflash.cab#version=4,0,0,0">
  <param name="MOVIE" value="document.swf">
  <param name="PLAY" value="true">
  <param name="LOOP" value="true">
  <param name="QUALITY" value="high">
  <param name="ALLOWSCRIPTACCESS" value="always">
  <embed src="document.swf" width="419" height="595"
   play="true" align="" loop="true" quality="high"
   type="application/x-shockwave-flash"
   allowscriptaccess="always"
   pluginspage="http://www.macromedia.com/go/getflashplayer">
  </embed>
</object>

The swftools provide a HTML code generator:

swfdump --html document.swf

See http://wiki.swftools.org/index.php?title=Pdf2swf for more information.

I don't really recommend this.