HTML to PDF API
Convert HTML to PDF instantly
POST raw HTML, receive a PDF. Sync for pages under 200KB, async job queue for large documents up to 1MB. Powered by Chromium — full CSS and JavaScript support.
POST raw HTML, receive a PDF. Sync for pages under 200KB, async job queue for large documents up to 1MB. Powered by Chromium — full CSS and JavaScript support.
Send raw HTML in the request body. The response is a binary PDF file ready to save or stream.
curl -X POST "https://api.apibravo.com/htmltopdf/v1/render?format=A4&margin=10" \ -H "Content-Type: text/html" \ -H "X-RapidAPI-Key: YOUR_API_KEY" \ -H "X-RapidAPI-Host: html-to-pdf37.p.rapidapi.com" \ -d "<html><body><h1>Hello PDF</h1></body></html>" \ --output output.pdf
const fs = require('fs'); const axios = require('axios'); const response = await axios.post( 'https://api.apibravo.com/htmltopdf/v1/render?format=A4&margin=10', '<html><body><h1>Hello PDF</h1></body></html>', { headers: { 'Content-Type': 'text/html', 'X-RapidAPI-Key': 'YOUR_API_KEY', 'X-RapidAPI-Host': 'html-to-pdf37.p.rapidapi.com' }, responseType: 'arraybuffer' } ); fs.writeFileSync('output.pdf', response.data);
import requests response = requests.post( 'https://api.apibravo.com/htmltopdf/v1/render?format=A4&margin=10', data='<html><body><h1>Hello PDF</h1></body></html>'.encode(), headers={ 'Content-Type': 'text/html', 'X-RapidAPI-Key': 'YOUR_API_KEY', 'X-RapidAPI-Host': 'html-to-pdf37.p.rapidapi.com' } ) with open('output.pdf', 'wb') as f: f.write(response.content)
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.apibravo.com/htmltopdf/v1/render?format=A4'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, '<html><body><h1>Hello PDF</h1></body></html>'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: text/html', 'X-RapidAPI-Key: YOUR_API_KEY', 'X-RapidAPI-Host: html-to-pdf37.p.rapidapi.com' ]); $pdf = curl_exec($ch); curl_close($ch); file_put_contents('output.pdf', $pdf);
Submit raw HTML and receive a PDF immediately. Best for documents under 200KB.
| Header | Value |
|---|---|
| Content-Type | text/html |
Submit HTML up to 1MB. Returns a job ID to poll. Available on Pro, Ultra, and Mega plans.
{ "job_id": "550e8400-e29b-41d4-a716-446655440000", "status": "pending" }
Poll until status is completed or failed. The download_url is valid for 24 hours.
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"download_url": "https://pub-xxx.r2.dev/pdfs/550e8400.pdf",
"created_at": "2024-01-01T00:00:00Z"
}
| Status | Meaning |
|---|---|
| pending | Queued, not yet started |
| processing | Currently rendering |
| completed | PDF ready — download_url included |
| failed | Render failed — error field included |
Pass as query parameters. All optional.
| Param | Default | Values | Description |
|---|---|---|---|
| format | A4 | A4, Letter, Legal | Page format |
| orientation | portrait | portrait, landscape | Page orientation |
| margin | 10 | 0 – 50 | Margin in mm, all sides |
| printBackground | true | true, false | Print background colors and images |
| waitFor | 0 | 0 – 5000 | Milliseconds to wait before rendering |
| Status | Meaning |
|---|---|
| 400 | Invalid params or empty body |
| 401 | Missing or invalid API key |
| 403 | Async jobs require a paid plan |
| 413 | HTML exceeds size limit for this endpoint |
| 429 | Rate limit exceeded for your plan |
| 503 | Render queue full — retry shortly |
All plans on RapidAPI. Upgrade or downgrade any time. No contracts.