Skip to Content
Web Design in a Nutshell, 3rd Edition
book

Web Design in a Nutshell, 3rd Edition

by Jennifer Robbins
February 2006
Intermediate to advanced
826 pages
63h 42m
English
O'Reilly Media, Inc.
Content preview from Web Design in a Nutshell, 3rd Edition

Embedding a PDF file

PDF files may also be embedded in a web page like an image. The standards-compliant markup for embedding a PDF is:

<object type="application/pdf" data="directions.pdf" width="450"
height="600">
</object>

Browsers that use the Netscape plug-in architecture may require the nonstandard embed element to display the PDF inline. The href attribute is added so multipage PDF files will open in the reader if the image is clicked. (In Internet Explorer, multipage PDFs are accessible inline using the embedded Acrobat Reader controls for paging through the file.)

It is common for web authors to combine object and embed elements to cover all the bases like this:

<object type="application/pdf" data="directions.pdf" width="450"
height="600">
  <embed src="directions.pdf" width="450" height="400" href="directions.
pdf">
    <noembed><a href="directions.pdf">Link to documentation (PDF)</a></
noembed>
  </embed>
</object>

Warning

Be aware that embed is a nonstandard element that will prevent an (X)HTML document from validating. We are moving toward a standards-compliant Web in which the object element alone will be sufficient, but for the time being, the embed element is still being used to ensure cross-browser support of embedded media.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Responsive Web Design with HTML5 and CSS3

Beginning Responsive Web Design with HTML5 and CSS3

Jonathan Fielding

Publisher Resources

ISBN: 0596009879Errata Page