'PDF download in Nextjs

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?



Solution 1:[1]

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.

Solution 2:[2]

every day method

<a href="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" target="_blank" rel="noopener noreferrer" ><button>Download CV</button></a>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tomás Rivera H.
Solution 2 K J