How to link to a page in a pdf file.

One of our customers, Jason, recently asked:

Is there a way to link to a given .pdf page with DOCman?

I usually just copy/send the file link as so:
https://www.example.com/index.php/11-training/file

Is there a way to get it to open to page 6 of that document for instance?

Yes, you can. Keep in mind that not all browsers open PDFs. Microsoft Internet Explorer and Safari (Mac OS) are capable of opening PDF files in the browser by using the Adobe Acrobat plug-in. Google Chrome and Mozilla Firefox will open PDF files in the browser and (at-the-time-of-writing) are the only browsers that support PDF page linking.

Here's how it's done.

HTML Anchors

You probably already know that in HTML, you can link to a specific part of the page using anchors. For example:

<!-- example-page.html -->
<h3 id="html-anchor">This heading is a HTML anchor</h3>
<!-- example-page-2.html -->
<a href="example-page.html#html-anchor">Go to the heading with this html anchor</a>

When you click the link in example-page2.html, your browser will redirect you to the correct location in example-page.html, regardless of how far down the page it is.

OK, that's pretty clear, so how do we achieve this in a PDF file?

Linking to a page in a PDF file

PDF files do not have anchors that can be linked to, instead you can link to a specific page like this:

<a href="pdf-document.pdf#page=11">

In Chrome and Firefox this URL will link the user to page 11 of pdf-document.pdf.

Note: This is not a query string, although it does look like one. We're using a hash instead of a question mark.

Linking to a page in a DOCman document associated with a PDF file

In order to link to a page in a DOCman document associated with a PDF file you must first get the url link to the PDF file. You can get the PDF file's link by right-clicking on the "View" button of the DOCman document and copying the link address, or you can just add /file at the end of the URL of the document.

Once you have copied the link address, simply paste it into your content and append your page hash to the end of the PDF file's url link.

For example:

http://www.example.com/documents/alfa-romeo/giulia/8-owner-s-manual-2/file

Becomes:

http://www.example.com/documents/alfa-romeo/giulia/8-owner-s-manual-2/file#page=11

That's it!

Get started

Supercharge your Joomla document management with DOCman. Go ahead and try DOCman on our demo or download it from our Support Center. Not yet a member? Get a subscription and start using DOCman today!

Be the first to know about upcoming extensions, features, and news by following us on Twitter, Facebook or Linkedin