Hack 69 Hyperlink HTML to PDF Pages

 < Day Day Up > 

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)

 page=   N   

Display PDF bookmarks

 pagemode=bookmarks 

Display PDF thumbnails

 pagemode=thumbs 

Conceal PDF bookmarks and thumbnails

 pagemode=none 

Conceal the Acrobat scrollbars

 scrollbar=false 

Conceal the Acrobat toolbar

 toolbar=false 


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:

 http://pdfhacks.com/mydoc.pdf#page=17&pagemode=bookmarks 

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.

 < Day Day Up > 


PDF Hacks.
PDF Hacks: 100 Industrial-Strength Tips & Tools
ISBN: 0596006551
EAN: 2147483647
Year: N/A
Pages: 158
Authors: Sid Steward

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net