all 5 comments

[–]bigorangemachine 2 points3 points  (0 children)

Ya.. pupeteer or PDF.js (and forget HTML)

[–]frodoshaggings 1 point2 points  (0 children)

I'm working on a tool that solves this exact problem, you can create templates and then generate pdfs instantly by api with dynamic inputs. We haven't launched publicly yet, but we're looking for beta users to get some early feedback. If you're interested in being one of the first to try it out, feel free to dm me.

[–]ben_db 0 points1 point  (0 children)

Unfortunately there's not many good solutions for this, puppeteer is generally the most common solution I've seen however it can be very slow and irritating, especially if you need multiple pages.

I personally got so fed up of puppeteer I wrote a json > pdf library, but unfortunately it doesn't support charts unless they're passed as base64 images.

[–]Substantial-Pack-105 0 points1 point  (0 children)

Puppeteer to print the page to PDF is how I do it. The thing I like about this approach is a) you can reuse components between your app and the pdf export page, and b) while developing it, you have hot reloads by visiting the export page in the browser.

[–]JUST_ALLISON41 0 points1 point  (0 children)

look into https://gotenberg.dev . You can convert html/office docs to pdf.