๐Ÿ“„

HTML to PDF API

Convert webpages and raw HTML to pixel-perfect PDF documents. A4, Letter, Legal formats. Custom margins. Print backgrounds.

Get Free API Key Read Docs

Quick Start

# From a URL
curl -X POST https://batian.icu/api/v1/pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/report", "format": "A4"}' \
  -o report.pdf

# From raw HTML
curl -X POST https://batian.icu/api/v1/pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html": "

Invoice #42

Total: $500

", "format": "A4"}' \ -o invoice.pdf

Features

URL or Raw HTML

Pass a URL to convert an existing page, or send raw HTML for dynamic documents like invoices and receipts.

Multiple Page Formats

A4, Letter, Legal, Tabloid. Custom margins control top, right, bottom, left independently.

Print Backgrounds

Background colors and images render in the PDF โ€” unlike browser print-to-PDF which strips them by default.

No Headless Chrome Setup

We maintain the Chromium instances. You send JSON, you get a PDF. No Docker, no puppeteer.launch(), no chromium flags.

Use Cases

๐Ÿงพ Invoice Generation โ€” Render HTML invoices as PDFs. Send raw HTML with dynamic data, get back a professional PDF.

๐Ÿ“‹ Report Automation โ€” Convert analytics dashboards, weekly reports, or data summaries to PDF for email distribution.

๐Ÿ“ Contract & Legal Documents โ€” Generate terms of service, contracts, NDAs as PDFs from HTML templates with custom margins.

๐ŸŽซ Tickets & Certificates โ€” Create event tickets, course certificates, or reservation confirmations. HTML โ†’ PDF in one API call.

Parameters

ParameterTypeDefaultDescription
urlstringโ€”URL to convert (use url OR html)
htmlstringโ€”Raw HTML to convert (use url OR html)
formatstringA4Page size: A4, Letter, Legal, Tabloid
marginstring10mmPage margin (CSS value like "10mm" or "0.5in")

Start generating PDFs instantly

100 free PDF conversions every month. No credit card. Instant API key.

Get Free API Key