HTML to PDF API — Convert HTML Templates to PDF via REST
A PDF generation API for developers. Send HTML or Markdown, get a pixel-perfect PDF back. Handlebars templates, custom CSS, headers and footers. Billed by compute time from $0.0012/second — no monthly fee.
How It Works
- POST your HTML or Markdown — send HTML, Markdown, or a Handlebars template with data to the REST API
- Receive PDF URL or binary — get back a CDN-hosted PDF URL or stream the binary directly
- Store or serve to users — download, redirect, or embed in your application
Code Example
curl -X POST https://sed.sh/api/reports \\
-H "Authorization: Bearer YOUR_API_KEY" \\
-H "Content-Type: application/json" \\
-d '{"html": "<h1>Invoice #1042</h1><p>Amount due: $99.00</p>"}'
# Response:
# { "id": "rpt_abc123", "url": "https://cdn.sed.sh/reports/rpt_abc123.pdf", "status": "complete" }
Features
- Custom Templates — Handlebars templates with dynamic data merging for invoices, receipts, and certificates
- Headers & Footers — page numbers, logos, and text on every page
- CSS Styling — full CSS support including custom fonts, colors, and print-optimized layouts
- Markdown Support — pass Markdown and receive a styled PDF, no HTML required
- Async Generation — fire-and-forget for large documents
- Webhook Delivery — receive a callback when generation completes
Pricing
| Provider | Price | Model |
|---|---|---|
| sed.sh | from $0.0012/s | Pay per compute second, no subscription |
| PDFShift | $9+/month | Monthly subscription, generation caps |
| DocRaptor | $15+/month | Monthly subscription |
| API2PDF | $14.95/month | Monthly subscription |
Frequently Asked Questions
What is the best HTML to PDF API?
It depends on your volume and stack. PDFShift and DocRaptor offer subscription plans starting at $9–$15/month. sed.sh bills by compute time from $0.0012/second with no monthly fee — better for variable or low-volume workloads.
How do I convert HTML to PDF programmatically?
Send a POST request to a PDF generation API with your HTML in the request body. For example, POST to https://api.sed.sh/reports with your HTML string and receive a PDF URL or binary in the response. No browser automation or headless Chrome required.
How much does sed.sh HTML to PDF API cost?
Billed by compute time: $0.0012/second for the first 10,000s, $0.0008 for 10,001–50,000s, $0.0005 for 50,001s+. No monthly subscription, no caps. Start with a $10 deposit.
Does sed.sh support PDF templates with dynamic data?
Yes. Create Handlebars templates with placeholders like {{name}} and {{total}}, then pass a JSON data object when generating. sed.sh merges the data into the template and returns the final PDF.