# HTML to PDF API and MCP server for AI agents > Drop an HTML file and get a PDF. Or let Claude, ChatGPT, Cursor or your code do it with one API call. 100 free pages · 1 credit = 1 page · from $0.005/page · credits never expire · no subscription. ## Works with Claude, ChatGPT, Cursor and any MCP client No code needed. Paste this into your AI agent: ``` Read https://html-pdf.com/llms.txt and set up html-pdf.com so you can create PDFs for me. ``` Then ask: "Make a PDF invoice for Acme, $1,200, due next Friday." MCP server: `https://html-pdf.com/mcp` (Streamable HTTP, `Authorization: Bearer `). Tools: `html_to_pdf`, `url_to_pdf`, `get_credits`, `buy_credits`. Connect with OAuth (log in when asked) or a Bearer key. Setup for each client: https://html-pdf.com/mcp.md ```bash claude mcp add --transport http html-pdf https://html-pdf.com/mcp --header "Authorization: Bearer $HTML_PDF_KEY" ``` ## What agents make with it Invoices and receipts, reports, contracts and proposals, certificates and tickets, resumes and one-pagers, and automations in n8n, Make or Zapier via an HTTP request. ## Convert HTML to PDF with one API call ```bash # Get a key (or at https://html-pdf.com/login) curl -X POST https://html-pdf.com/v1/signup -H "Content-Type: application/json" -d '{"email":"you@example.com"}' # Open the link we email you to confirm (adds the 100 free credits) curl https://html-pdf.com/v1/pdf \ -H "Authorization: Bearer $HTML_PDF_KEY" \ -H "Content-Type: application/json" \ -d '{"html": "

Invoice #042

", "format": "A4"}' \ -o invoice.pdf ``` Paper sizes, margins, headers/footers with page numbers, custom CSS, JavaScript rendering. Reference: https://html-pdf.com/docs.md ## Pixel-perfect PDFs with headless Chrome, zero setup - Real Chrome: modern CSS, flexbox, grid, web fonts, JavaScript. - No Puppeteer, wkhtmltopdf or Chromium to run yourself. - 1 credit = 1 page; failed renders cost zero. - Private: HTML isn't stored; download links expire after 24 hours. - ~0.5 s for a one-page document; 120 requests/minute per account. ## Pay per page. No subscription. Credits never expire. | 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 | ## FAQ - **Can Claude or ChatGPT generate a PDF?** With code execution on, they can draw basic PDFs in Python; for HTML/CSS-designed, pixel-perfect PDFs, connect html-pdf.com as an MCP server. - **Is there a free HTML to PDF API?** Yes: 100 free pages per account, no credit card. - **What is a credit?** One PDF page. Failed conversions are free. Cap cost with `max_pages`. - **Do credits expire?** No. - **n8n / Make / Zapier?** Yes, with an HTTP request to `https://html-pdf.com/v1/pdf`. - **URL to PDF?** Send the page's HTML; it can load public images, fonts and CSS. - **Do you store documents?** No. Download links are deleted after 24 hours.