Pay-per-use · No subscriptions

The HTML to PDF API Built for Developers

Convert any HTML to a pixel-perfect PDF in under 2 seconds via REST API.

HTML2DocHub provides a fast, reliable HTML to PDF API powered by Chromium. No server setup needed. Send HTML or a URL, get back a signed download URL. Pay only for what you use — starting at ₹0.10 per page. No monthly fees, no minimums.

Why developers choose HTML2DocHub

Chromium-based rendering for pixel-perfect output
Pass raw HTML string or a URL to render
Custom page format: A4, Letter, Legal, A3
Header/footer templates, custom margins, print backgrounds
Sync (instant response) or async (webhook) modes
Idempotency keys to prevent duplicate charges
Signed S3 URLs with configurable expiry
Pay only per page rendered — no subscription
Clear per-job total: output_pages and final_cost in every response
Rate limiting per API key — you stay in control

Code Examples

cURL – HTML to PDFcurl
curl -X POST https://api.html2dochub.com/v1/render \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "pdf",
    "html": "<h1>Invoice #1042</h1><p>Amount: $299.00</p>",
    "options": {
      "format": "A4",
      "print_background": true,
      "margin_top": "2cm",
      "margin_bottom": "2cm"
    }
  }'

# Response:
# {
#   "job_id": "...",
#   "status": "completed",
#   "pages": 1,
#   "cost": "₹0.10",
#   "download_url": "https://cdn.html2dochub.com/..."
# }
Python – HTML to PDFpython
import requests

resp = requests.post(
    "https://api.html2dochub.com/v1/render",
    headers={"X-API-Key": "sk_live_YOUR_KEY"},
    json={
        "type": "pdf",
        "html": open("invoice.html").read(),
        "options": {"format": "A4", "print_background": True},
    },
)

data = resp.json()
print(f"Pages: {data['output_pages']}, Cost: {data['final_cost']}")

# Download the PDF
import urllib.request
urllib.request.urlretrieve(data["download_url"], "invoice.pdf")
Node.js – HTML to PDFnode
const fs = require("fs");

const response = await fetch("https://api.html2dochub.com/v1/render", {
  method: "POST",
  headers: {
    "X-API-Key": "sk_live_YOUR_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    type: "pdf",
    html: fs.readFileSync("invoice.html", "utf8"),
    options: { format: "A4", print_background: true },
  }),
});

const { download_url, final_cost } = await response.json();
console.log("Cost:", final_cost);

// Save to disk
const pdfResp = await fetch(download_url);
const buffer = await pdfResp.arrayBuffer();
fs.writeFileSync("invoice.pdf", Buffer.from(buffer));

Simple, transparent pricing

Pay only for pages rendered. No subscriptions. No minimum monthly fee.

1 page PDF:~₹0.10
10 page PDF:~₹0.80
100 pages/day:~₹8/day
See full pricing details

Frequently Asked Questions

What HTML is supported?+
Any HTML5 + CSS3 that renders in Chrome is supported. We use Chromium internally, so modern layouts, Flexbox, Grid, custom fonts, and CSS variables all work.
How fast is the HTML to PDF conversion?+
Average render time is under 2 seconds for a standard A4 page. Simple documents often render in under 500ms.
Can I render HTML from a URL?+
Yes — pass the `url` field instead of `html`. We protect against SSRF attacks, so private/internal IPs are blocked.
Is there a page limit?+
The default maximum is 100 pages per job. This can be configured by contacting support.
How does pricing work?+
You pay per page on successful jobs, with a ₹0.10 minimum per completed render. See typical examples on our pricing page; each response includes final_cost and output_pages.
Do I need a credit card to start?+
No. You get a free API key instantly. You only need to add funds when you start rendering.

Start rendering PDFs today

Free account. No credit card required. API ready in minutes.

Get your free API key