Need to generate PDFs from HTML in your app? Here's how to do it with EditPDFree API - a free PDF processing API.
## Get Your API Key
Head to api.editpdfree.com, create a free account, and grab your API key from the dashboard. Free tier gives you 50 requests/month.
## Convert HTML to PDF
### cURL
bash
curl -X POST https://api.editpdfree.com/api/v1/html-to-pdf \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_KEY" \
-d '{"html": "<h1>Hello World</h1><p>Generated with EditPDFree API</p>"}' \
-o output.pdf
JavaScript (Node.js)
const resp = await fetch('https://api.editpdfree.com/api/v1/html-to-pdf', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_KEY'
},
body: JSON.stringify({
html: '<h1>Invoice #1234</h1><p>Total: $99.00</p>',
options: { format: 'A4', margin: { top: '20mm', bottom: '20mm' } }
})
});
const pdf = await resp.blob();
Python
import requests
resp = requests.post(
'https://api.editpdfree.com/api/v1/html-to-pdf',
headers={'X-API-Key': 'YOUR_KEY'},
json={
'html': '<h1>Invoice #1234</h1>',
'options': {'format': 'A4'}
}
)
with open('output.pdf', 'wb') as f:
f.write(resp.content)
Other Endpoints
The API also supports:
- URL to PDF - Convert any webpage to PDF
- Merge - Combine up to 50 PDFs
- Compress - Reduce PDF file size
- Split - Extract specific pages
- Watermark - Add text watermarks
- Protect - Password-protect with AES-256
Pricing
Free tier: 50 requests/month.
Paid plans start at $9/month for 500 requests with no watermark.
https://api.editpdfree.com - there's a live playground on the landing page where you can test without signing up.
---
What PDF features would you like to see next? Let me know in the comments!
Top comments (0)