Sometimes, we want to download a PDF file instead of opening them in browser when clicked.
In this article, we’ll look at how to download a PDF file instead of opening them in browser when clicked.
How to download a PDF file instead of opening them in browser when clicked?
To download a PDF file instead of opening them in browser when clicked, we can add the download
attribute to the link.
For instance, we write
<a href="http://link/to/file" download="FileName">Download it!</a>
to set the download
attribute of the anchor element to the file name of file when we download it.
Then when we click on the link, the file will be downloaded.
Conclusion
To download a PDF file instead of opening them in browser when clicked, we can add the download
attribute to the link.