I got tired of running headless Chrome myself just to turn HTML invoices into PDF attachments. So I built a small API and listed it on RapidAPI: Simple PDF API.
Free tier included. No browser setup on your side.
The problem
Every SaaS eventually needs PDFs:
- Invoices and receipts
- Reports and exports
- Downloadable confirmations
The usual options:
- Run Puppeteer/Playwright yourself — works, but ops pain (memory, crashes, scaling)
- Enterprise PDF APIs — great, but $15–75/mo before you have revenue
- wkhtmltopdf — dated CSS support
I wanted: JSON in → PDF bytes out. One POST. Done.
The solution
curl --request POST \
--url "https://simple-pdf-api.p.rapidapi.com/v1/html-to-pdf" \
--header "Content-Type: application/json" \
--header "X-RapidAPI-Key: YOUR_KEY" \
--header "X-RapidAPI-Host: simple-pdf-api.p.rapidapi.com" \
--data '{
"html": "<html><body><h1>Invoice #1042</h1><p>Total: $99.00</p></body></html>",
"page_size": "A4"
}' \
--output invoice.pdf
That's it. You get raw application/pdf bytes back.
JavaScript example
const res = await fetch("https://simple-pdf-api.p.rapidapi.com/v1/html-to-pdf", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Key": process.env.RAPIDAPI_KEY,
"X-RapidAPI-Host": "simple-pdf-api.p.rapidapi.com",
},
body: JSON.stringify({
html: invoiceHtml,
page_size: "A4",
}),
});
const pdf = Buffer.from(await res.arrayBuffer());
// attach to email, upload to S3, etc.
Python example
import requests
resp = requests.post(
"https://simple-pdf-api.p.rapidapi.com/v1/html-to-pdf",
headers={
"X-RapidAPI-Key": "YOUR_KEY",
"X-RapidAPI-Host": "simple-pdf-api.p.rapidapi.com",
},
json={"html": invoice_html, "page_size": "A4"},
timeout=90,
)
resp.raise_for_status()
with open("invoice.pdf", "wb") as f:
f.write(resp.content)
What else is included
Same API key, same subscription:
- HTML or URL → PDF — full CSS via headless Chromium
- Merge PDFs — combine multiple documents
- Split PDF — extract page ranges
- Watermark — add CONFIDENTIAL / DRAFT overlays
- Compress — reduce file size by removing duplicate objects
- Protect — AES password-encrypt with configurable print permissions
- Rotate — rotate all or selected pages by 90, 180, or 270°
- Extract text — pull plain text for search/indexing
8 endpoints, one API key.
Pricing
| Plan | Price | Quota |
|---|---|---|
| BASIC | Free | ~50 req/day |
| PRO | $9/mo | 5,000 req/mo |
| ULTRA | $29/mo | 25,000 req/mo |
Enough free tier to test. PRO is priced for indie devs and early-stage SaaS.
Try it
- Subscribe on RapidAPI (free plan)
- Copy your API key
- Paste the curl above
- Open
invoice.pdf
Interactive API docs: https://pdf-api-production-9570.up.railway.app/docs
Built with FastAPI + Playwright. Happy to answer integration questions in the comments.
Top comments (0)