Hack 69 Hyperlink HTML to PDF Pages

figs/moderate.gif figs/hack69.gif

Take readers directly to the information they seek.

You can use HTML hyperlinks, those famous filaments of the Web, to integrate PDF documents with HTML documents. A simple link to a PDF document is not enough, though, because a single PDF might hold hundreds of pages. It is like handing a haystack to somebody searching for a needle. The solution is to modify the HTML link so that it takes the reader directly to the PDF page of interest. This kind of seamless integration of HTML and PDF pages requires some groundwork. See [Hack #67] for details.

To tailor a hyperlink's PDF destination, just add one or more of the suffixes listed in Table 5-3 to the href path.

Table 5-3. Suffixes and their impact on Acrobat Reader

PDF viewer behavior

Hyperlink href path suffix

Open the PDF to page number N (the first page is 1)


Display PDF bookmarks


Display PDF thumbnails


Conceal PDF bookmarks and thumbnails


Conceal the Acrobat scrollbars


Conceal the Acrobat toolbar


These are glued together and appended to the href path using a special notation. The first suffix follows a hash mark. Each additional suffix follows an ampersand. These options are fully documented in PDF Open Parameters, located at http://partners.adobe.com/asn/acrobat/sdk/public/docs/PDFOpenParams.pdf.

For example, to open mydoc.pdf to page 17 and display its document bookmarks, the hyperlink href would look like this:


These special PDF hyperlinks do not work when you're using Internet Explorer and the PDF is on your local disk. For a workaround, see [Hack #17] .

5.20.1 Save Display Settings in the PDF

You can also save these display settings in the PDF file. Whenever and however the PDF is opened, it will be displayed according to your settings. See [Hack #62] for details.