HTML to PDF API and MCP server for AI agents
Turn HTML or any web page into a PDF. Let Claude ChatGPT Cursor Claude Code n8n Zapier </> your code do it in one call.
100 free pages · 1 credit = 1 page · from $0.005/page · credits never expire · no subscription
Remote MCP server for Claude, ChatGPT, Cursor and Claude Code
No code, no install, no npx. Paste this into your AI agent and it sets everything up, including your free account.
Read https://html-pdf.com/llms.txt and set up html-pdf.com so you can create PDFs for me.
Then just ask: "Make a PDF invoice for Acme, $1,200, due next Friday." Your agent writes the HTML, html-pdf.com turns it into a PDF, and you get a download link.
claude mcp add --transport http html-pdf https://html-pdf.com/mcp \
--header "Authorization: Bearer $HTML_PDF_KEY"
// ~/.cursor/mcp.json
{
"mcpServers": {
"html-pdf": {
"url": "https://html-pdf.com/mcp",
"headers": { "Authorization": "Bearer hp_live_..." }
}
}
}
# Claude: Customize → Connectors → Add custom connector
# ChatGPT: developer mode → create an MCP app with this URL
https://html-pdf.com/mcp
# then click Connect and log in with your email
# ~/.codex/config.toml
[mcp_servers.html-pdf]
url = "https://html-pdf.com/mcp"
bearer_token_env_var = "HTML_PDF_KEY"
MCP tools: html_to_pdf, url_to_pdf, get_credits, buy_credits. Log in with OAuth or use a key. Step-by-step: guides for every tool · MCP reference
What agents make with it
Automate PDFs without writing HTML
Pick a template, connect the app you already use, and a PDF is created for every new order, form response or row. No code needed. The template is a ready-made page design that we turn into a PDF.
- Shopify ordersinvoice or packing slip per order
- WooCommerce ordersPDF invoice, emailed automatically
- Stripe paymentsbranded receipts
- Google Formseach response as a PDF
- Google Sheetsone PDF per row
- Notiondatabase items to PDF
- Typeformresults to PDF
- Gmailarchive emails as PDF
Start from a free template, try the free invoice generator or certificate generator, or browse all automation guides.
Generate PDFs from HTML in one API call
curl https://html-pdf.com/v1/pdf \
-H "Authorization: Bearer $HTML_PDF_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Invoice #042</h1>", "format": "A4"}' \
-o invoice.pdf
const res = await fetch("https://html-pdf.com/v1/pdf", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HTML_PDF_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ html: "<h1>Invoice #042</h1>", format: "A4" }),
});
fs.writeFileSync("invoice.pdf", Buffer.from(await res.arrayBuffer()));
import os, requests
r = requests.post(
"https://html-pdf.com/v1/pdf",
headers={"Authorization": f"Bearer {os.environ['HTML_PDF_KEY']}"},
json={"html": "<h1>Invoice #042</h1>", "format": "A4"},
)
open("invoice.pdf", "wb").write(r.content)
curl https://html-pdf.com/v1/pdf \
-H "Authorization: Bearer $HTML_PDF_KEY" \
-d '{"url": "https://example.com", "media": "screen"}' \
-o page.pdf
Guides: HTML to PDF in Python · in Node.js · API reference · OpenAPI · llms.txt
Works with n8n, Make and Zapier
Add an HTTP request step, POST your HTML to https://html-pdf.com/v1/pdf with your key, and get a PDF back. Add "response": "url" to get a download link instead of a file, which is easiest in no-code tools.
Full CSS support, rendered by headless Chrome
- layout
- Flexbox, grid, web fonts, SVG and Tailwind. If Chrome renders it, it works.
- page breaks
break-before: page,break-inside: avoid,@pagesize and margins.- headers & footers
- Repeated on every page, with page numbers:
<span class="pageNumber">oftotalPages. - javascript
- Charts and client-rendered pages: wait with
wait_delayorwait_for_expression. - paper
- A3 to A6, Letter, Legal, Tabloid or any custom size, portrait or landscape.
Why not Puppeteer, wkhtmltopdf or Gotenberg yourself?
- no servers
- No Chromium to install, patch and keep alive, no cold starts, no 1 GB container to scale.
- maintained
- wkhtmltopdf is archived and can't render modern CSS. We keep Chrome up to date for you. Compare →
- safe by default
- Untrusted HTML can't reach private networks. Failed renders cost zero.
- agent-ready
- Remote MCP, llms.txt, OpenAPI and signup by API, so your agent can set it up for you.
- private
- Your HTML isn't stored. Download links expire after 24 hours.
Pay per page. No subscription. Credits never expire.
Start with 100 free pages. Buy a pack when you need more. The bigger the pack, the cheaper each page, and it lasts until you use it.
| pack | pages | per page | you save | lasts at 10 pages/day |
|---|---|---|---|---|
| free | 100 | - | - | ~10 days |
| $10 | 1,000 | $0.0100 | - | ~3 months |
| $25 | 3,000 | $0.0083 | 17% | ~10 months |
| $50 | 7,000 | $0.0071 | 29% | ~2 years |
| $100 | 15,000 | $0.0067 | 33% | ~4 years |
| $250 | 50,000 | $0.0050 | 50% | ~14 years |
Per page vs monthly plans
| html-pdf.com | PDFShift | DocRaptor | |
|---|---|---|---|
| billing | one-off packs | monthly plan | monthly plan |
| unused credits | never expire | reset monthly | reset monthly |
| entry price | $10 / 1,000 pages | $9 / 500 docs per month | $15 / 125 docs per month |
| free | 100 pages | 50 / month | 5 / month |
| remote MCP server | yes | community only | no |
Competitor prices from their public pricing pages, checked October 2026. PDFShift alternative →
HTML to PDF API FAQ
How do I convert HTML to PDF with an API?
POST to https://html-pdf.com/v1/pdf with your API key and {"html": "<h1>Hello</h1>"}, or {"url": "https://example.com"}. The response is the PDF. API reference.
Is there a free HTML to PDF API?
Yes. Every account gets 100 free pages, no credit card. After that, packs start at $10 for 1,000 pages.
How much does an HTML to PDF API cost?
Here, from $0.01 per page ($10 for 1,000) down to $0.005 per page ($250 for 50,000), with no subscription. Purchased credits never expire.
What is a PDF MCP server?
MCP (Model Context Protocol) lets AI agents like Claude, ChatGPT and Cursor use new tools. Our remote MCP server adds html_to_pdf and url_to_pdf, so your agent can create real PDF files. There is nothing to install, you just add the URL. Setup guides.
Can Claude or ChatGPT generate a PDF?
When code execution is turned on, they can draw basic PDFs with Python libraries, but layout, fonts and branding are limited. Connect html-pdf.com as an MCP server (or paste the setup prompt above) and your agent designs the document in HTML and CSS and gets a pixel-perfect PDF back. More: ChatGPT · Claude.
Can I convert a URL to PDF?
Yes. Send {"url": "https://..."} instead of html, or use the URL tab in the converter above. Public pages only; for pages behind a login, send their HTML.
Does it support CSS page breaks, headers and footers?
Yes. Use break-before: page and break-inside: avoid for page breaks, and header_html / footer_html with page-number placeholders for repeated headers and footers.
What is a credit?
One PDF page. A 3-page report uses 3 credits. Failed conversions use none, and you can cap cost per request with max_pages.
Do credits expire?
No. Purchased credits never expire and nothing resets monthly.
Does it work with n8n, Make or Zapier?
Yes. Use the HTTP request module: POST to https://html-pdf.com/v1/pdf with your key in the Authorization header. Add "response": "url" to get a download link. n8n guide.
Do you store my documents?
No. HTML is rendered and discarded. PDFs are only kept when you ask for a download link, and deleted after 24 hours.
Give your agent a PDF printer
100 free pages. No credit card. Set up in one prompt.