DEV Community

cimigoo
cimigoo

Posted on

I Built a PDF API That Doesn't Use Chrome – Here's Why

I Built a PDF API That Doesn't Use Chrome

Most PDF generation APIs spin up a headless browser (Puppeteer, Playwright) to render HTML into a PDF. It works, but it's slow, expensive, and unpredictable.

So I built DocForge – a PDF generation API that uses PDFKit directly for deterministic, fast output.

How It Works

POST /api/generate
{
  "template": "invoice",
  "data": {
    "invoice_number": "INV-001",
    "from": { "name": "Acme Corp" },
    "to": { "name": "Client Corp" },
    "items": [...],
    "total": 49.99
  }
}
→ Returns a PDF in ~3 seconds
Enter fullscreen mode Exit fullscreen mode

Why Not Chrome?

Headless Chrome PDFKit (DocForge)
Speed 5-15 seconds ~3 seconds
Memory 500MB+ per instance ~50MB
Deterministic ❌ Different renders possible ✅ Same input = same output
Cost Expensive at scale Cheap at scale

5 Templates Available Now

  • Invoice – Professional billing with line items
  • Receipt – Payment confirmation
  • Certificate – Achievement/completion certificates
  • Report – Data-driven reports
  • Contract – Legal document templates

Free to Try

DocForge is currently free to try. Just grab an API key and start generating PDFs.

👉 Try DocForge

What's Next?

I'm adding more templates based on developer feedback. What PDF templates do you need most? Drop a comment below!


Built with PDFKit + Vercel Serverless Functions. No Chrome harmed in the making of these PDFs.

Top comments (0)