HTML to PDF API

Convert HTML, webpages, and URLs to pixel-perfect PDFs. Full CSS & JavaScript support. Custom headers, footers, and page settings.

$0.02 per conversion • Full CSS/JS support • Custom page sizes

# Convert URL to PDF
curl -X POST "https://api.chargedapi.com/pdf/url-to-pdf" \
  -H "X-API-Key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

# Convert HTML string to PDF
curl -X POST "https://api.chargedapi.com/pdf/url-to-pdf" \
  -H "X-API-Key: your_api_key" \
  -d '{"html": "<h1>Hello World</h1>"}'

Powerful HTML to PDF Features

URL to PDF

Convert any public webpage to PDF. Just pass the URL and get a perfect PDF rendering.

HTML String to PDF

Pass raw HTML content directly. Perfect for invoices, reports, and dynamic documents.

Full CSS Support

Modern CSS including Flexbox, Grid, custom fonts, and print stylesheets fully supported.

JavaScript Rendering

Full JavaScript execution. Convert SPAs, charts, and dynamically rendered content.

Custom Page Settings

A4, Letter, Legal, or custom dimensions. Set margins, orientation, and scale.

Headers & Footers

Add custom headers and footers with page numbers, dates, and logos.

Common Use Cases

Invoice Generation

Generate professional PDF invoices from HTML templates. Perfect for billing systems and e-commerce platforms.

Reports & Dashboards

Convert analytics dashboards and reports to shareable PDFs with charts and graphs intact.

Receipts & Tickets

Generate PDF receipts, tickets, and confirmations from your web application.

Web Page Archiving

Archive web content as PDFs for compliance, legal records, or offline access.

Code Examples

Python

import requests

response = requests.post(
    "https://api.chargedapi.com/pdf/url-to-pdf",
    headers={"X-API-Key": "your_api_key"},
    json={
        "url": "https://example.com",
        "format": "A4",
        "landscape": False
    }
)

pdf_url = response.json()["download_url"]

JavaScript

const response = await fetch(
  "https://api.chargedapi.com/pdf/url-to-pdf",
  {
    method: "POST",
    headers: {
      "X-API-Key": "your_api_key",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      html: "<h1>Invoice #123</h1>"
    })
  }
);

const { download_url } = await response.json();

Simple, Transparent Pricing

$0.02
per HTML to PDF conversion
  • 50 free conversions to start
  • Full CSS & JavaScript support
  • Custom headers & footers
  • Any page size or orientation
  • Files auto-deleted after 24 hours
Get Started Free

Start Converting HTML to PDF

Pixel-perfect PDF generation from any HTML source. Try free today.

Get Your Free API Key