Skip to main content

HTML to PDF API

Send HTML, a URL or Markdown in one request and get the PDF back in the response, rendered by Chromium.

Convert HTML to PDF in one request

POST the HTML to /quickjob with your API key. The response body is the PDF.

HTML to PDF with curl

html-to-pdf.sh
curl -X POST https://api.podpdf.com/quickjob \
  -H "X-API-Key: $PODPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_type": "html",
    "html": "<h1>Invoice INV-1042</h1><p>Total due: $850.00</p>",
    "options": {
      "format": "A4",
      "margin": { "top": "20mm", "bottom": "20mm" },
      "printBackground": true
    }
  }' \
  --output invoice.pdf

HTML to PDF in Node.js

html-to-pdf.mjs
const res = await fetch('https://api.podpdf.com/quickjob', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.PODPDF_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    input_type: 'html',
    html: '<h1>Hello</h1><p>Rendered by Chromium.</p>',
    options: { format: 'Letter', landscape: false },
  }),
});

const pdf = Buffer.from(await res.arrayBuffer());
console.log('pages:', res.headers.get('X-PDF-Pages'));

URL to PDF

url-to-pdf.sh
curl -X POST https://api.podpdf.com/quickjob \
  -H "X-API-Key: $PODPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "input_type": "url", "url": "https://example.com/" }' \
  --output page.pdf

Page numbers in the footer

report.sh
curl -X POST https://api.podpdf.com/quickjob \
  -H "X-API-Key: $PODPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_type": "html",
    "html": "<h1>Quarterly report</h1>...",
    "options": {
      "margin": { "top": "15mm", "bottom": "20mm" },
      "displayHeaderFooter": true,
      "headerTemplate": "<span></span>",
      "footerTemplate": "<div style=\"font-size:9px;width:100%;text-align:center\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>"
    }
  }' \
  --output report.pdf
  • Up to 25 pages in under 30 seconds
  • Up to 5 MB of HTML per request
  • The X-PDF-Pages header gives the page count
  • Longer documents: POST /longjob, up to 100 pages

What the HTML to PDF API handles

Real Chromium rendering

Flexbox, grid, web fonts, SVG and print CSS render the way they do in Chrome, so what you design in the browser is what lands in the PDF.

PDF back in the response

Up to 25 pages come back as the response body within 30 seconds. No polling, no second request.

Long documents and bulk runs

Queue documents up to 100 pages with a webhook when they finish, or convert 200 HTML and Markdown files in one bulk job.

Paper, margins, headers, footers

A4, Letter or any custom size, landscape, margins, page ranges, and header and footer templates with page numbers.

Accessible PDF/UA output

Ask for PDF/UA-1 or PDF/UA-2 and get a tagged PDF checked by veraPDF (alpha).

Also from Zapier, n8n and MCP

The same conversion runs from no-code tools and AI agents, with the same API key.

HTML to PDF API questions

Which HTML and CSS features are supported?
PodPDF renders with headless Chromium, so modern CSS works: flexbox, grid, custom fonts loaded by URL, SVG, background colours and @page rules. Set preferCSSPageSize to take the page size from your CSS instead of the format option.
Can I convert a URL to PDF?
Yes. Send input_type "url" with a public HTTPS address. The page is fetched on the server within 10 seconds and up to 5 MB. Relative asset paths on that page are not resolved, so images and stylesheets need absolute URLs.
How do I add page numbers?
Set displayHeaderFooter to true and pass a footerTemplate containing elements with the classes pageNumber and totalPages. Give them an explicit font-size and leave room with the bottom margin.
What does it cost?
You start with 10 free PDFs and no card. Monthly plans work out at $0.005 per PDF, and one-off credits are $0.01 per PDF. Failed conversions are not charged.
What if my document is longer than 25 pages?
Send the same request to POST /longjob. It is queued, runs up to 100 pages, and calls your webhook with a download link when it is done.
Can I convert Markdown too?
Yes. Send input_type "markdown" with the Markdown text. Images become PDFs with input_type "image", one page per image.

Generating the same document again and again?

Design an invoice, receipt or certificate as a template once, then send only the data as JSON.