How would one add this "Save page as PDF" functionality?

I really like the feature found on this Kinsta page with a box/image/text/download button that says “Download a PDF version for easier offline reading and sharing with coworkers.”

Ideally, I would like to simply do a “Print to PDF” from the browser and save the PDF in the Page Resources folder for the article ( /content/articleName/ ) using the page title as the filename.pdf in each case.

Has anyone done something like this (or similar) or is there a Hugo shortcode or partial out there that provides this kind of functionality? Thanks in advance!

The PDF download you reference at Kinsta is dynamic, and timestamps the PDF, after taking email information.

Reading that it sounds like you are going to add the PDFs as files to your site. If that is the case, I’m not sure how a partial or shortcode would assist, aside from linking to your PDFs by filename…

There are alternatives, depending on what you want to offer your site visitors. For instance, you could provide a really nice print stylesheet, and encourage visitors to either print using their browser, or script a button to do that same. More guidance at:

1 Like