6

I am trying to embed pdf file in HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<head>
    <title></title>
</head>
<body leftmargin="0" topmargin="0">

<embed src="mypdffile.pdf#page=9" style="width:595px; height:841px;"></embed>
</body>

According to PDF SDK https://docs.google.com/viewer?url=http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters_v9.pdf#search=&embedded=true&chrome=true it is possible to jump to a particular page while opening pdf document. But it doesn't work at least in Safari with AdobePDFViewer.plugin on MAC OS X.

Did I miss something?

Clifford
  • 88,407
  • 13
  • 85
  • 165
Koteg
  • 497
  • 7
  • 16

3 Answers3

10

You can use the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<object type="application/pdf" data="mypdffile.pdf" width="995" height="841" ></object>
<a href="mypdffile.pdf#page=9">Jump to page 9</a>
</body>
</html>

You can modify further the pdf file and what you wish to show/hide adding attributes on the data (according the adobe directions).

For example data="mypdffile.pdf#navpanes=0&scrollbar=0&toolbar=0&zoom=100

Sotiris
  • 38,986
  • 11
  • 53
  • 85
0

You can use the same parameters that Sotiris specified into the data attribute of the object tag so for example to show the PDF embedded directly in page 5 you'll have to do something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
    </head>
    <body>
        <object type="application/pdf" data="mypdffile.pdf#page=5" width="995" height="841" ></object>
            <a href="mypdffile.pdf#page=5">Jump to page 9</a>
    </body>
</html>
David Núñez
  • 51
  • 1
  • 4
  • I am not sure why this answer was downvoted. The only remark is that that jump link doesn't make any sense (as it didn't in the original answer of Sotiris, since the question is about showing a particular page from the beginning). – texnic Aug 06 '23 at 19:28
0

You are correct, but use object instead of embed (see <embed> vs. <object> for explanation):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<object type="application/pdf" 
data="filename.pdf#page=5&navpanes=0&scrollbar=0&view=fit" width="300" height="300" >
</object>
</body>
</html>
texnic
  • 3,959
  • 4
  • 42
  • 75