Link to a specific page in a PDF file

A drawing of a cartoon man pointing upwards

Heads up! This post was written in 2014, so it may contain information that is no longer accurate. I keep posts like this around for historical purposes and to prevent link rot, so please keep this in mind as you're reading.

— Cory

Both Chrome and Firefox render PDF files in the browser, making them easier for users to view. Today I wanted to send someone a link to a certain page in a PDF user's manual. Here's how I did it.

In HTML, you can link to a specific part of the page this using anchors. For example:

<!-- page.html -->
<h2 id="anchor-name">Deep Linking Rocks!</h2>

<!-- another-page.html -->
<a href="page.html#anchor-name">Go to it!</a>

When you click the link, your browser will take you to the correct location in page.html, no matter how far down it is.

But how do you do that with a PDF file? Well, we don't have access to any IDs so the best we can do is pick a page and link to that instead. Try this:

<a href="document.pdf#page=10">

Per Adobe, this will link the user to page 10 of document.pdf in Chrome and Firefox. Note that we're using a hash instead of a question mark—it's not actually query string even though it looks a lot like one.

Alas, not all browsers open PDFs, so it's best to tell users which page they should look for in case they're using an unsupportive browser.

As of this writing, Chrome and Firefox both handle this beautifully. Although Safari opens PDFs, it doesn't seem to acknowledge the hash. Of course, this will also work if the user has the Adobe Reader plugin installed.