1. Home
  2. Web designing
  3. How to Create a HTML anchor link to a specific page in PDF?

How to Create a HTML anchor link to a specific page in PDF?

Generally HTML pages can contain links that can target to PDF file and when clicked, the browser opens the PDF file starting from the first page. Well that’s the default behavior, but I wanted to create a link in HTML page and that should point to a particular page in a PDF file. For instance, I wanted to target a HTML link to page number 30 in a PDF document that has more than 100 pages. I just googled around and found a solution; surprisingly it’s super easy.

All you need to do is, just add #page=<page_number> to the HREF attribute of an anchor tag. The below example links to page number 30 in a PDF file.

<a href="http://example.com/demo.pdf#page=30">Page 30 of PDF</a>

You can also create a bookmark or destination using Acrobat and then link to a particular destination as shown below:

<a href="http://example.com/demo.pdf#statistics">Page 30 of PDF</a>

Note: This trick does not work if a PDF file was reference locally such as (D:\folder\demo.pdf) and it works only when a PDF file is accessed via HTTP or HTTPs protocol.

That’s it! How cool was that?


Related Content
Updated on September 3, 2017

Was this article helpful?

Related Articles

Add A Comment