HTML to PDF

HTML to PDF API

Convert HTML content to downloadable PDF documents with a single POST request. Invoices, reports, contracts — generate PDFs from any HTML.

Parameters

ParamRequiredDescription
htmlRequiredHTML content to convert to PDF
titleOptionalPDF document title (default: "Document")

Code Examples

cURL

curl -X POST "https://api-snap.com/api/pdf" \
  -H "Authorization: Bearer snp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Invoice #1234</h1><p>Total: $99.00</p>", "title": "Invoice"}' \
  -o invoice.pdf

JavaScript

const res = await fetch("https://api-snap.com/api/pdf", {
  method: "POST",
  headers: {
    Authorization: "Bearer snp_your_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    html: "<h1>Report</h1><table>...</table>",
    title: "Monthly Report",
  }),
});
const blob = await res.blob();

Python

import requests

r = requests.post(
    "https://api-snap.com/api/pdf",
    json={"html": "<h1>Contract</h1><p>Terms...</p>", "title": "Contract"},
    headers={"Authorization": "Bearer snp_your_key"},
)
with open("contract.pdf", "wb") as f:
    f.write(r.content)

Common Use Cases

Invoices & receipts

Generate PDF invoices from HTML templates with dynamic data

Reports

Convert dashboard data and charts into downloadable PDF reports

Contracts

Create PDF contracts from HTML forms for e-signature workflows

Certificates

Generate personalized certificates and diplomas as PDF downloads

Start Generating PDFs

HTML in, PDF out. One API call, zero headless browser setup.

Get Your Free API Key