PDF4.dev is a PDF generation API that lets developers create pixel-perfect PDFs from HTML templates. Design templates visually or in code using a Monaco-based editor with live preview, define dynamic fields with Handlebars {{variables}}, and generate PDFs via a simple REST API call from any language: TypeScript, Python, Go, Rust, PHP, or cURL. The rendering pipeline uses headless Chromium (Playwright) for accurate CSS support including flexbox, grid, and web fonts. PDF4.dev also provides a built-in MCP server so AI agents like Claude, ChatGPT, and Cursor can generate PDFs with natural language. Free browser-based PDF tools (merge, split, compress, convert) process files entirely client-side for privacy. Self-hostable via Docker with SQLite storage, PDF4.dev is a developer-first alternative to PDFMonkey, DocRaptor, and DIY Puppeteer setups.
PDF4.dev is the first PDF API with native MCP (Model Context Protocol) support. 14 MCP tools let AI agents like Claude, ChatGPT, Cursor, Windsurf, and VS Code generate PDFs with natural language. The MCP server supports visual preview and full template CRUD.
| Feature | PDF4.dev | DIY Puppeteer | PDFMonkey |
|---|---|---|---|
| Setup time | ~5 minutes | Hours of config | ~30 minutes |
| Template editor | Code + visual editor | Build your own | Basic |
| Live preview | Yes | Build your own | Partial |
| Non-technical editing | Visual editor: no code | Code only | Basic editor |
| API docs | OpenAPI 3.1 | Write your own | Basic |
| Usage limits | Generous | None | 20-5,000/mo |
| Language support | Any (REST API) | Node.js only | Limited SDKs |
| Integration time | ~5 minutes | Days to weeks | ~30 minutes |
| Maintenance | Managed | All on you | Managed |
| Reusable components | Headers, footers, blocks | Build your own | None |
| Batch generation | CSV/JSON upload, ZIP download | Build your own | API only |
| AI agent support | MCP server with annotations | None | None |
24 free browser-based PDF tools. Files never leave your browser.
Generate a PDF with a single POST request. Send your template ID and data as JSON, receive a PDF binary. Works with TypeScript, Python, Go, Rust, PHP, and cURL. Bearer token authentication with OpenAPI 3.1 spec.
Design templates visually. Render via API in ~300ms. Any language.

Works with any language that can send an HTTP request.
const res = await fetch('https://pdf4.dev/api/v1/render', {
method: 'POST',
headers: {
'Authorization': 'Bearer p4_live_xxxxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template_id: 'invoice',
data: {
company: 'Acme Corp',
amount: '$1,500.00',
date: '2026-03-06'
}
})
})
const pdf = await res.blob() // That's it.
Invoice
Report
Quote
Receipt



Full HTML editor with syntax highlighting and Handlebars autocompletion. For when your team needs full control.
Edit templates visually, no code required. Perfect for business teams who update designs without waiting on developers.
See your PDF render in real-time as you type. Accurate page dimensions and margins.
A4, Letter, landscape, square, or fully custom. Configurable margins, fonts, and background.
Bearer auth, OpenAPI 3.1 spec, interactive docs. Works with any language: TypeScript, Python, Go, Rust, PHP, cURL.
Headers, footers, and blocks: create once, share across templates. Headers and footers repeat on every page automatically.
Upload a CSV or JSON, map columns to variables, and generate hundreds of PDFs in one click. Download as ZIP.
Full history: status, duration, file size. Filterable and cursor-paginated.
The first PDF API with native MCP support. Connect your favorite AI tool and generate PDFs with natural language.
14 MCP tools · Visual preview · Natural language control
Free to start. No credit card required.