Embedding a PDF File in an HTML Document

To avoid non-standard <embed> tags, you can use the <object> tag:


<object data="file:///tmp/test.pdf"
       width="640"
       height="480"
       type="application/pdf">
  <a href="file:///tmp/test.pdf">my test pdf file</a>
</object>

Note that the link to the file is only given if the browser cannot figure out what to do with the <object> tag. That way, at least those people can still download the file, or something. When I tried this with Camino it didn’t work until I had supplied the width, height, and type arguments. Makes sense, I guess.

One Response

  1. aswin Says:

    excellent information for beginners.

    thank u

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.