The simplest way to link to a PDF
To create a link to a PDF, you write an HTML anchor tag that points to the file's location. The most basic version looks like this: <a href="document.pdf">Click here to open the PDF</a>. When someone clicks the text between the opening and closing tags, their browser either opens the PDF in a new window or downloads it, depending on their browser settings and the file size.
The file path in the href attribute can be a relative path (pointing to a file on your own website) or an absolute path (pointing to a PDF anywhere on the internet). If your PDF sits in the same folder as your HTML file, you only need the filename. If it's in a subfolder called "documents", you'd write href="documents/document.pdf". If the PDF lives on another website entirely, use the full web address: href="https://example.com/files/document.pdf".
Key Takeaways
- A PDF link is an HTML anchor tag with an href attribute pointing to the PDF file's location, either on your site or elsewhere.
- Relative paths work when the PDF is on your own website; absolute paths (full URLs) are needed for PDFs hosted elsewhere.
- You can control whether the PDF opens in the same window or a new one by adding a target attribute to your link.
- Adding a download attribute to the link forces the browser to download the file instead of opening it.
Opening the PDF in a new window or tab
By default, clicking a PDF link may open the file in the same browser window, replacing the page the reader was viewing. To keep your page visible and open the PDF in a new tab or window instead, add target="_blank" to the anchor tag: <a href="document.pdf" target="_blank">Open PDF in new tab</a>.
This is often the better choice for user experience, because readers can view the PDF without losing their place on your original page. They can then close the PDF tab and return to where they were. The target="_blank" attribute works the same way whether the PDF is on your site or elsewhere.
Forcing a download instead of opening
Some browsers will display a PDF in their built-in viewer when you click a link. If you want the file to download to the reader's computer instead, add the download attribute: <a href="document.pdf" download>Download PDF</a>. You can also specify what name the file should have when it lands on their computer by adding a value: <a href="document.pdf" download="my-filename.pdf">Download PDF</a>.
The download attribute works in all modern browsers. If you don't specify a filename, the browser uses the original filename from the href. This approach is useful when you want readers to save a copy of the document rather than view it temporarily in their browser.
Linking to a specific page within a PDF
You can link directly to a particular page inside a PDF by adding a page number to the end of the URL. The syntax is href="document.pdf#page=3" to jump to page 3. Not all browsers and PDF viewers support this feature equally — it works reliably in Chrome and Firefox, but Safari and Internet Explorer may not recognize the page anchor.
Some PDF viewers also support named destinations, which are bookmarks set within the PDF itself. If the PDF creator added these, you can link to them using href="document.pdf#destination-name". You would need to know the exact name of the destination, which the PDF creator should provide.
Combining attributes for different situations
You can mix these attributes together depending on what you need. For example, <a href="document.pdf" target="_blank" download>Download PDF in new tab</a> opens the PDF in a new window and triggers a download at the same time. Or <a href="https://example.com/files/report.pdf" target="_blank">View external PDF</a> links to a PDF on another website and opens it in a new tab.
The order of attributes does not matter — the browser reads them all regardless of sequence. What matters is choosing the combination that matches your purpose: same window or new window, open in viewer or download to computer, and whether you're linking to your own file or someone else's.
Checking that your link works
After you create a link, test it in your browser before publishing. Click the link and confirm that the PDF either opens or downloads as you intended. If the link does not work, the most common causes are a wrong file path, a typo in the filename, or a file that has been moved or deleted.
If you're using a relative path and the link breaks after you move your HTML file to a different folder, update the path to match the new location. If you're linking to a PDF on another website, check that the URL is still correct — external links can break if the other site reorganizes their files.
Frequently Asked Questions
What's the difference between a relative path and an absolute path?
A relative path describes where the PDF is located in relation to your HTML file — for example, "documents/report.pdf" means the file is in a subfolder called documents. An absolute path is the complete web address, like "https://example.com/documents/report.pdf", and works no matter where your HTML file is. Use relative paths for files on your own website and absolute paths for files elsewhere.
Can I link to a PDF on Google Drive or Dropbox?
Yes, but you need the correct sharing link. For Google Drive, right-click the file, select "Share", and copy the link. You may need to adjust the URL slightly — change the end from "view" to "export?gid=0" to force a download. For Dropbox, use the share link but change the end from "?dl=0" to "?dl=1" to download instead of preview. Test the link to make sure it works for people who don't have access to your account.
What happens if someone's browser doesn't support PDFs?
Modern browsers all support PDF viewing, but very old browsers or unusual devices might not. You can provide a fallback by offering both a link to the PDF and a link to an HTML or text version of the same content. Most readers will be able to open the PDF without any problem.
Can I make the PDF open at a specific zoom level?
Some PDF viewers support zoom parameters in the URL, like "document.pdf#zoom=150" for 150 percent zoom. However, support varies widely between browsers and PDF readers. The most reliable approach is to assume the reader's browser will use its default zoom, and design your PDF with readable text at normal zoom levels.
Does the file size of the PDF affect how the link works?
File size does not change how the link itself works, but it affects user experience. Large PDFs may take time to download or open, especially on slower connections. Consider compressing large PDFs before linking to them, or breaking very long documents into smaller files so readers can download only the pages they need.