Is it possible to have a button/link that will trigger download PDF on click?
I am creating a portfolio, and have one part where u need to download my CV, is it possible, and how if it is?
Yes! It is possible, the first thing to have in mind is where are you going to host the pdf that you are going to download. You can have it as an asset on your webpage or in a storage bucket from any of the major providers then just add the following snippet.
<a href='assets/my_pdf.pdf' download>Download pdf</a>
And you would replace assets/my_pdf.pdf with the url pointing to your file.
In Nextjs 13 (I'm not sure if it's the same in other versions) you would need to place your pdf file in the public directory of your project. Then you can use a simple <a> tag like so <a href="/resume.pdf" download>Download</a>
For reference check out this discussion on github
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With