DEV Community

Cover image for I got tired of Puppeteer PDF hell so I built a REST API
Sanskar Sharma
Sanskar Sharma

Posted on

I got tired of Puppeteer PDF hell so I built a REST API

Every developer has been here.
Your product manager drops a ticket: "We need to generate PDF invoices."
Simple enough, right?
Three hours later you're:

Debugging why Puppeteer crashes in Docker but works on your machine
Fighting with CSS that renders perfectly in the browser but breaks as a PDF
Writing 200 lines of HTML templates that no designer can ever touch
Setting up a separate worker process just so Chromium doesn't crash your main server
Building file storage for generated PDFs
Writing cleanup jobs so your disk doesn't fill up

And you still haven't built the actual feature you needed the PDF for.
I've been there more times than I want to admit.

So I built Templar
Templar is a REST API for PDF generation. Here's how it works:

  1. Describe your document Tell the AI what you want an invoice, a report, a contract, a receipt. It generates the HTML template for you.

  1. Call the API with your data POST /api/render
{
  "templateName": "invoice",
  "data": {
    "customerName": "John Doe",
    "amount": "$499",
    "dueDate": "2026-06-01"
  }
}
Enter fullscreen mode Exit fullscreen mode

  1. Get a PDF URL back
{
  "url": "https://cdn.odysii.in/pdf-123.pdf",
  "message": "PDF generated successfully"
}
Enter fullscreen mode Exit fullscreen mode

That's it.
No Puppeteer. No HTML templates. No worker processes. No storage setup. No cleanup jobs.

Who is it for
If you're a developer or building a SaaS and you've ever lost hours to document generation, Templar is for you.
Invoices, reports, contracts, receipts, anything your backend needs to generate, Templar handles it in seconds via one API call.

Try it at Templar
Would love your feedback. Still early days 🚀

Top comments (0)