Get started

Generate PDFs with AI agents

PDF4.dev is the first PDF API with a built-in MCP server. Connect your favorite AI tool and generate PDFs with natural language, no code needed.

How it works

1. Get an API key

Create a free account and generate an API key in Settings.

2. Connect your AI tool

Add the PDF4.dev MCP server to your AI client configuration (see below).

3. Ask in natural language

“Generate an invoice for Acme Corp”, your agent handles the rest.

MCP server setup

Add PDF4.dev as an MCP server in your preferred AI client. Pass your API key via the Authorization header (recommended) or as a tool parameter.

{
  "mcpServers": {
    "pdf4dev": {
      "url": "https://pdf4.dev/api/mcp",
      "headers": {
        "Authorization": "Bearer p4_live_xxx"
      }
    }
  }
}
Add to ~/Library/Application Support/Claude/claude_desktop_config.json

14 tools, full PDF lifecycle

Generate, preview, manage templates and components, and monitor usage. All accessible via natural language. Each tool includes MCP annotations so AI agents know which tools are safe to call without confirmation.

Built-in Handlebars helpers

All templates have access to formatting, logic, and math helpers. No setup needed, just use them in your HTML.

Formatting

Format numbers, dates, and currencies with locale support.

{{formatNumber 10000 "en-US"}}10,000{{formatDate date "short"}}Mar 8, 2026{{formatCurrency 1500 "EUR" "fr-FR"}}1 500,00 €

Logic & comparison

Conditionals and comparisons for dynamic content.

{{#if (eq status "paid")}}Paid{{/if}}Paid{{#each items}}...{{/each}}Loop over arrayseq, neq, gt, lt, gte, lteComparison helpers

Text & math

String transforms and arithmetic operations.

{{uppercase value}}HELLO{{math price "*" quantity}}(product){{padStart id 5 "0"}}00042

Just describe what you want

The AI agent picks the right tools automatically. Here are some things you can ask.

invoice.htmlreceipt.htmlClaudeDesign me a modern invoice wit…×
Design me a modern invoice with my company logo and colors
create_templatetmpl_xK2m · created
name: "Modern Invoice"html: 312 lines
render_pdf2.1 MB · 340ms
template_id: "modern-invoice"data: sample

Invoice template created with your brand colors and logo. Here's a preview with sample data.

Claude_...
Queue another message...
▶▶Edit automatically</> 1 line selected◑ 42% used/

Ready to generate PDFs with AI?

Create an account, grab your API key, and connect your favorite AI tool in under 2 minutes.

Get started