Originally published byDev.to
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.
πΊπΈ
More news from United StatesUnited States
NORTH AMERICA
Related News
Why Every Developer Needs a Strong Test Suite (Even If You Hate Writing Tests)
1d ago
SOLSTICE SIDEBAR - AI INCIDENT DESK
1d ago
Passkeys in 2026: A Practical Engineering Guide to Passwordless Auth
1d ago
The CFO's AI Playbook: 5 Finance Automations Every Indian Business Should Run in 2026
1d ago
AWS S3 Basics for Beginners
1d ago