Convert HTML content to PDF files using our online converter
Use this API endpoint to convert HTML to PDF programmatically:
POST /api/v2Using Vercel-optimized endpoint for production deployment
curl -X POST http://localhost:3000/api/v2 \
-H "Content-Type: application/json" \
-d '{"html":"<h1>Hello World</h1>"}' \
--output output.pdfcurl -X POST http://localhost:3000/api/v2 \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com"}' \
--output webpage.pdf// For HTML content:
{
"html": "<h1>Your HTML content</h1>",
"options": {
"format": "A4",
"printBackground": true,
"marginTop": "1cm",
"marginRight": "1cm",
"marginBottom": "1cm",
"marginLeft": "1cm",
"landscape": false
}
}
// For website URL:
{
"url": "https://example.com",
"options": {
"format": "A4",
"printBackground": true,
"marginTop": "1cm",
"marginRight": "1cm",
"marginBottom": "1cm",
"marginLeft": "1cm",
"landscape": false
}
}