Documents · HTML to PDF API
Your HTML becomes a browser-quality PDF.
Send HTML and CSS and get back PDFs, PNGs or JPGs rendered by a real Chromium. Generate invoices, reports and certificates one at a time or in templated batches, without maintaining rendering servers.
curl -X POST 'https://api.respawntech.dev/v1/tools/document/pdf/convert' \
-H "X-API-Token: $RESPAWN_API_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"html": "<h1>Fatura #001</h1><p>Total: R$ 199,90</p>",
"format": "pdf",
"page_size": "A4",
"webhook_url": "https://seu-app.com/webhooks/pdf"
}'Use cases
Convert HTML and CSS to PDF, PNG or JPG — one document or 500 at once.
Invoices, receipts and payment slips
Turn the HTML you already have into documents ready to send to your customers.
Reports with charts
Enable JavaScript to render charts and SPAs before generating the PDF.
Certificates and contracts in bulk
One template, up to 500 variations per batch, with volume discounts.
How it works
From sign-up to first call in minutes
Send the HTML
POST HTML, CSS and options; get a conversion_id with status 202.
Wait for the webhook
Your endpoint is called when the job finishes — no polling.
Download the file
Download the PDF (or the batch ZIP) from the download endpoint.
Features
Built to run in production
Faithful rendering
Headless Chromium with support for modern CSS, Google Fonts, and per-page headers and footers.
PDF, PNG or JPG
Choose the format, page size (A4, Letter, Legal), orientation, margins and scale.
Templated batches
Send a template with placeholders and up to 500 items; download everything as a ZIP.
Truly asynchronous
Get a 202 right away and be notified by webhook when the file is ready.
Sandboxed JavaScript
Turn on enable_js for pages that depend on scripts, waiting for a selector or a delay.
Retention under control
Ephemeral files for ~24 h, retention up to 30 days or permanent, stored encrypted.
Pricing
Pay for usage, not a subscription
Each document starts at 1 credit. Retention beyond 3 days and JavaScript are add-ons, and batches of 10 items or more get an automatic discount.
HTML to PDF — per document
| Item | Credits |
|---|---|
| Base conversion | 1.0 |
Retention up to 3 daysretention_days ≤ 3 | +0.0 |
Retention from 4 to 7 daysretention_days 4–7 | +0.5 |
Retention from 8 to 30 daysretention_days 8–30 | +2.5 |
Permanent retentionretention_days: -1 | +15.0 |
Sandboxed JavaScriptenable_js | +0.25 |
HTML to PDF — batch discounts
| From | Discount |
|---|---|
| 10+ | 5% |
| 20+ | 10% |
| 30+ | 15% |
| 40+ | 20% |
API reads (after the daily free quota)
Per-query prices, charged only after the day's free reads.
| Operation | Credits |
|---|---|
| List conversions or batches | 0.005 |
| Conversion or batch status | 0.01 |
| File or ZIP download | 0.03 |
Use cases
What you can build
FAQ
Frequently asked questions
How long does a conversion take?
Simple documents are usually ready in seconds. Since processing is asynchronous, use webhook_url to get notified without having to poll the status.
Can I use external fonts and images?
Yes. Use google_fonts_url for Google Fonts and absolute URLs for images and stylesheets.
How long is the file available?
By default, up to 3 days at no extra cost. You can choose ephemeral retention (~24 h), up to 30 days or permanent.
What if the conversion fails?
The status gives the reason in error_code. You can reprocess the conversion; failures don't produce a downloadable file.
Start integrating today
Create your account, generate a token and make your first call in a few minutes.