Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jump to a particular page when embedding pdf document in HTML

Tags:

html

pdf

embed

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?

like image 310
Koteg Avatar asked Sep 01 '10 09:09

Koteg


People also ask

How do I jump to a specific page in a PDF?

You can easily jump to a specific page in a PDF. The fastest way is to simply type the page number into the field in the middle of the status bar (at the bottom of the PDF Annotator window) and hit the ENTER key. Another option is to choose View, Go to, Page from the menu and enter the page number.

How do I get the first page of my PDF in HTML?

Method 1: Using Object Tag HTML's object tag is the first way to embed PDF files. In the below example, the pdf file will be displayed on a web page, which is an object. In addition to embedding a pdf file into a webpage, the object tag can embed ActiveX, Flash, video, audio, and Java applets.

How do you link to a PDF in HTML?

The easiest way to put PDF in an HTML document is using the <a> tag with its href attribute. You need to add the URL or the reference link of your PDF file to the element.


1 Answers

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

like image 128
Sotiris Avatar answered Oct 13 '22 11:10

Sotiris