HTML to PDF API Alternatives — Puppeteer, iText & When to Use RatPDF
Compare HTML to PDF APIs: Puppeteer, wkhtmltopdf, Gotenberg, SaaS renderers, and browser tools. CSS pitfalls and decision tree for developers.
Published July 2, 2025 · 1 min read
Teams pick an HTML to PDF API when invoices, tickets, or reports must render server-side — but the market spans headless Chrome, legacy WebKit wrappers, and hosted SaaS. This guide compares common approaches and when RatPDF's browser HTML to PDF tool fits (no deploy, no API key).
HTML to PDF API alternatives compared
| Approach | Best for | Trade-offs |
|---|---|---|
| Puppeteer / Playwright | Full CSS3, SPAs after render | Ops overhead — Chrome in Docker, memory per job |
| wkhtmltopdf | Legacy templates, simple HTML | Stale WebKit; flexbox gaps; maintenance mode |
| iText html2pdf / OpenPDF | Java/.NET server PDF stacks | No JS execution; inline CSS works best |
| Gotenberg | Self-hosted API wrapping Chromium | You run and scale the container fleet |
| DocRaptor / PDFShift / similar SaaS | Managed API, SLA, PrinceXML option | Per-document cost; data leaves your VPC |
| Browser print → PDF | One-off exports | Not automatable; margins inconsistent |
| RatPDF HTML to PDF | Ad-hoc templates, QA renders, small batches | Not a REST API — browser upload; 3 free uses/day |
Decision tree
- Need JavaScript to run? → Puppeteer, Playwright, or Gotenberg — not static html2pdf alone.
- 100% self-contained HTML + CSS? → iText html2pdf (RatPDF uses this) or wkhtmltopdf for simple layouts.
- Don't want to operate Chrome? → Hosted API (DocRaptor, PDFShift) or RatPDF for manual batches.
- Unicode invoices (₹, €, CJK)? → Embed fonts in HTML; test with same engine as production.
CSS and font pitfalls (all engines)
- Use
@page { size: A4; margin: 20mm; }for print margins — not body padding alone - Prefer inline or embedded CSS; relative
url(font.woff2)paths break on server render - Test with production HTML snapshot — not live SPA URLs that need auth cookies
- Page breaks:
page-break-before: alwayson section headers
Original example: invoice template QA
Startup renders GST invoice HTML from their Node app via Puppeteer in production. Designer updates CSS — staging API queue is backed up. Developer pastes static HTML into RatPDF HTML to PDF, verifies table alignment and ₹ symbol in 30 seconds, then promotes CSS to Puppeteer template. Production API unchanged; RatPDF used as visual regression shortcut.
When RatPDF is enough vs when you need an API
| Scenario | RatPDF tool | Self-hosted API |
|---|---|---|
| Monthly manual report export | Yes | Overkill |
| 1000 tickets/hour from queue | No | Yes — Puppeteer/Gotenberg |
| CI snapshot test of one template | Yes | Optional |
| Customer-facing SLA + retry logic | No | Yes — hosted or own fleet |
Related resources
Sources & references
Primary references used when researching and fact-checking this guide. See our editorial methodology.
-
iText html2pdf — HTML to PDF
— iText Group
HTML/CSS to PDF conversion engine used in server-side Java and .NET stacks. -
Adobe PDF Reference — encryption
— Adobe
PDF password protection and encryption standards (ISO 32000).