HTML to PDF conversion API

High-quality HTML to PDF conversion for your apps and automation workflows.

Reliable HTML to PDF rendering on a Chromium engine we keep up to date.

NewSingle-page PDFs
POST /v1/generate
curl https://api.html2pdf.app/v1/generate \
  -H 'X-API-Key: <your-api-key>' \
  -H 'Content-Type: application/json' \
  -d '{"html": "https://example.com/invoice/42"}' \
  --output invoice.pdf
200 OK · application/pdf
  • 1.7M+
    Conversions per month
  • 1.5K+
    Developers and teams
  • 1.8s
    Average processing time
  • 99.9%
    Uptime

Try our HTML to PDF online converter

Enter a public webpage URL and get it back as a PDF.

Everything you need to convert HTML to PDF

A fast, developer-friendly API with everything you need for high-quality PDF generation.

Browser-based rendering

Modern HTML, CSS, and JavaScript in an up-to-date Chromium, with nothing for you to maintain.

Templates

Ready-made invoice, receipt, CV and report templates you can drop into the API.

Single-page PDFs

One PDF page as tall as the content, with no page breaks. Ideal for receipts and long web pages.

Lazy-loaded images

Scroll through the page before rendering, so images and content that load on scroll are included.

Asynchronous requests

Generate PDFs in the background and receive completed documents at your callback URL.

Encryption and passwords

Protect PDFs with a password and control permissions such as printing and copying.

Tools and integrations

Convert pages in your browser, test API requests in the playground, or add PDF downloads to WordPress.

HTML to PDF online converter

Convert a URL or raw HTML to PDF right in your browser, no code required.

API playground

Test the API in your browser and get ready-to-use code generated automatically from your settings.

WordPress PDF plugin

Convert any WordPress page or post to a PDF file using a simple shortcode.

Pricing

Start free, upgrade as you grow. The Free plan includes 100 credits a month and PDFs up to 1MB.

Prices in US dollars.

Free
$0 / month

100 credits a month

  • 1 parallel conversion
  • PDFs up to 1MB
  • All customization options
  • WordPress PDF plugin
Startup
$9 / month

1,000 credits a month

$9.00 per 1,000 credits

  • 3 parallel conversions
  • PDFs of any size
  • Priority support
  • Yearly billing, 2 months free
  • All customization options
  • WordPress PDF plugin
Recommended
Standard
$25 / month

5,000 credits a month

$5.00 per 1,000 credits

  • 10 parallel conversions
  • PDFs of any size
  • Priority support
  • Help with your integration
  • Yearly billing, 2 months free
  • All customization options
  • WordPress PDF plugin
Scale
$39 / month

10,000 credits a month

$3.90 per 1,000 credits

  • 20 parallel conversions
  • PDFs of any size
  • Priority support
  • Help with your integration
  • Yearly billing, 2 months free
  • All customization options
  • WordPress PDF plugin

1 credit covers up to 5MB of PDF output, so a 15MB PDF uses 3 credits.

Start quickly with code samples

Choose a language to see a quick HTML-to-PDF API example.

import { writeFile } from 'node:fs/promises';

const response = await fetch('https://api.html2pdf.app/v1/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': process.env.HTML2PDF_API_KEY,
  },
  body: JSON.stringify({
    html: '<h1>Hello world!</h1>',
  }),
});

const pdf = Buffer.from(await response.arrayBuffer());
await writeFile('document.pdf', pdf);