84

When providing a link to a PDF file on a website, is it possible to include information in the URL (request parameters) which will make the PDF browser plugin (if used) jump to a particular bookmark instead of just opening at the beginning?

Something like: http://www.somehost.com/user-guide.pdf?bookmark=chapter3 ?

If not a bookmark, would it be possible to go to a particular page?

I'm assuming that if there is an answer it may be specific to Adobe's PDF reader plugin or something, and may have version limitations, but I'm mostly interested in whether the technique exists at all.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Chris Carruthers
  • 3,945
  • 6
  • 31
  • 31

5 Answers5

79

Yes, you can link to specific pages by number or named locations and that will always work if the user's browser uses Adobe Reader as plugin for viewing PDF files.

For a specific page by number:

<a href="http://www.domain.com/file.pdf#page=3">Link text</a>

For a named location (destination):

<a href="http://www.domain.com/file.pdf#nameddest=TOC">Link text</a>


To create destinations within a PDF with Acrobat:

  1. Manually navigate through the PDF for the desired location
  2. Go to View > Navigation Tabs > Destinations
  3. Under Options, choose Scan Document
  4. Once this is completed, select New Destination from the Options menu and enter an appropriate name
Greg Dubicki
  • 5,983
  • 3
  • 55
  • 68
Wayne
  • 38,646
  • 4
  • 37
  • 49
  • 16
    Importent note: Named destinations are not bookmarks. You can add named destinations using adobe acrobat (full, not reader!) and its navigation panel "destinations". I have no knowledge how one link to bookmarks directly. There is no documented url parameter. – eFloh Oct 24 '11 at 13:46
  • I know this is an old question. But I wonder if someone does know how to add named destinations to a pdf when building the pdf in .net code. We're using the component dynamic pdf to create our pdf:s in .net. Dynamic pdf does not support adding named destionations. – mortb Jul 06 '12 at 14:49
  • 1
    it does not work with relative references, e.g. `somedir/my.pdf#page=3`, and *PDF-XChange Viewer* (created from a *my.docx* via *Save As .. pdf* of *MS Office Professional Plus 2010 / 14.0.7116.5000*) – Andreas Covidiot May 22 '14 at 12:45
  • 2
    It appears that a simple anchor mark works for "bookmarks", at least for chrome v57. So a link like Link text works for chrome v57 (or higher, I suppose) – Kemal Erdogan May 11 '17 at 10:09
17

RFC 3778 section 3 specifies "Fragment Identifiers" that can be used with PDF files, which include nameddest and page.

Community
  • 1
  • 1
sanxiyn
  • 3,648
  • 1
  • 19
  • 15
14

There are multiple query parameters that can be handled. Full list below:

Source

+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| Syntax                  | Description                                                                                  | Example                                              |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| nameddest=destination   | Specifies a named destination in the PDF document                                            | http://example.org/doc.pdf#Chapter6                  |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| page=pagenum            | Specifies a numbered page in the document, using an integer                                  | http://example.org/doc.pdf#page=3                    |
|                         | value. The document’s first page has a pagenum value of 1.                                   |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| comment=commentID       | Specifies a comment on a given page in the PDF document. Use                                 | #page=1&comment=452fde0e-fd22-457c-84aa-             |
|                         | the page command before this command.                                                        | 2cf5bed5a349                                         |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| collab=setting          | Sets the comment repository to be used to supply and store                                   | #collab=DAVFDF@http://review_server/Collab           |
|                         | comments for the document. This overrides the default comment                                | /user1                                               |
|                         | server for the review or the default preference. The setting is of the                       |                                                      |
|                         | form store_type@location, where valid values for store_type are:                             |                                                      |
|                         | ● DAVFDF (WebDAV)                                                                            |                                                      |
|                         | ● FSFDF (Network folder)                                                                     |                                                      |
|                         | ● DB (ADBC)                                                                                  |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| zoom=scale              | Sets the zoom and scroll factors, using float or integer values. For                         | http://example.org/doc.pdf#page=3&zoom=200,250,100   |
| zoom=scale,left,top     | example, a scale value of 100 indicates a zoom value of 100%.                                |                                                      |
|                         | Scroll values left and top are in a coordinate system where 0,0                              |                                                      |
|                         | represents the top left corner of the visible page, regardless of                            |                                                      |
|                         | document rotation                                                                            |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| view=Fit                | Set the view of the displayed page, using the keyword values                                 | http://example.org/doc.pdf#page=72&view=fitH,100     |
| view=FitH               | defined in the PDF language specification. For more information,                             |                                                      |
| view=FitH,top           | see the PDF Reference.                                                                       |                                                      |
| view=FitV               | Scroll values left and top are floats or integers in a coordinate                            |                                                      |
| view=FitV,left          | system where 0,0 represents the top left corner of the visible                               |                                                      |
| view=FitB               | page, regardless of document rotation.                                                       |                                                      |
| view=FitBH              | Use the page command before this command.                                                    |                                                      |
| view=FitBH,top          |                                                                                              |                                                      |
| view=FitBV              |                                                                                              |                                                      |
| view=FitBV,left         |                                                                                              |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| viewrect=left,top,wd,ht | Sets the view rectangle using float or integer values in a                                   |                                                      |
|                         | coordinate system where 0,0 represents the top left corner of the                            |                                                      |
|                         | visible page, regardless of document rotation.                                               |                                                      |
|                         | Use the page command before this command.                                                    |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| pagemode=bookmarks      | Displays bookmarks or thumbnails.                                                            | http://example.org/doc.pdf#pagemode=bookmarks&page=2 |
| pagemode=thumbs         |                                                                                              |                                                      |
| pagemode=none           |                                                                                              |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| scrollbar=1|0           | Turns scrollbars on or off                                                                   |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| search=wordList         | Opens the Search panel and performs a search for any of thewords in the specified word list. | #search="word1 word2"                                |
|                         | The first matching word ishighlighted in the document.                                       |                                                      |
|                         | The words must be enclosed in quotation marks and separated byspaces.                        |                                                      |
|                         | You can search only for single words. You cannot search for a string of words.               |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| toolbar=1|0             | Turns the toolbar on or off.                                                                 |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| statusbar=1|0           | Turns the status bar on or off.                                                              |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| messages=1|0            | Turns the document message bar on or off.                                                    |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| navpanes=1|0            | Turns the navigation panes and tabs on or off.                                               |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| highlight=lt,rt,top,btm | Highlights a specified rectangle on the displayed page. Use the                              |                                                      |
|                         | page command before this command.                                                            |                                                      |
|                         | The rectangle values are integers in a coordinate system where                               |                                                      |
|                         | 0,0 represents the top left corner of the visible page, regardless of                        |                                                      |
|                         | document rotation                                                                            |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| fdf=URL                 | Specifies an FDF file to populate form fields in the PDF file beingopened.                   | #fdf=http://example.org/doc.fdf                      |
|                         | Note: The fdf parameter should be specified last in a URL.                                   |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265
  • Nice that you have found full docs for this, @Matas. But isn't any newer doc available? This one is about 10 years old... – Greg Dubicki Feb 18 '17 at 21:51
  • 2
    @GregDubicki Hi Greg, I don't think there can be a new one, there could be one if they would release new type of pdf (like pdfx)... depends on where mechanism that handles url is I suppose.... – Matas Vaitkevicius Feb 19 '17 at 02:23
8

It's worth adding that Wayne's solution also works in:

  • Chrome (since v. 14 from 2011, see this issue for details) (tested on v. 87 and v. 44),
  • Firefox (tested on v. 84.0.1 and v. 40),
  • Opera (tested on v. 73 and v. 31),
  • Safari (tested on v. 14.0.2, it didn't work on v. 8),

(Updated with the current versions as of January 2021.)

Greg Dubicki
  • 5,983
  • 3
  • 55
  • 68
7

PDF Open Parameters documents the available URL fragments you can use.

rslemos
  • 2,454
  • 22
  • 32