Harden what you have
Keep Puppeteer and invest in the harness: a warm browser pool, a queue, memory limits, health checks and restarts.
Choose it when: Choose it when PDFs are a side output of automation you already run, volume is stable, and the engineering time is cheaper than a dependency. The work is well understood; it is just yours forever.
Playwright
The same browser class with a first-party API in more languages and arguably better ergonomics.
Choose it when: Choose it when the pain is the library, not the operations: it drives the same Chromium, so memory, lifecycle and harness costs are identical.
Gotenberg or a browser-pool service (self-hosted)
Move the browsers behind a stateless container API you operate once instead of in every service.
Choose it when: Choose it when you want to keep everything in-house for free and are comfortable owning the container's scaling and upgrades. Templating, metering and post-processing remain yours to build.
WeasyPrint
Drop the browser entirely for static documents.
Choose it when: Choose it for Python stacks with no-JavaScript documents; see the caveats above on modern CSS support.
KimiDoc (ours)
The same Chromium-class output behind one REST call, with the harness already built: a pre-warmed pool, queueing, per-document retry in 40,000-document batches, stored templates, encryption and watermarking. Hosted, or self-hosted inside your network under a licence.
Choose it when: Choose it when document volume is a product feature rather than a byproduct, or when the data cannot go to a generic cloud API. It is commercial; the free tier is 100 documents a month and previews are unmetered. Our detailed head-to-head is the <a href='/compare/puppeteer/'>Puppeteer comparison</a>.
Migrating, whichever you choose
Migrating off page.pdf() is mostly option mapping: format becomes a page size, margin becomes marginsMm, headerTemplate and footerTemplate become CSS @page margin boxes, and waitUntil heuristics become an explicit ready signal. The comparison page carries the full mapping.
Evaluating options?
Our side-by-side pages are dated and sourced, and say plainly when the other tool is the right choice.