Test the HTML to PDF conversion API with live examples and see the code
Enter or paste your HTML content
Configure your PDF output settings
Create your PDF with the current settings
Use these snippets to integrate the API
curl -X POST https://api.htmltopdf.ac/api/convert \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"html": "<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta ...",
"options": {
"format": "A4",
"orientation": "portrait",
"margin": {
"top": "1cm",
"right": "1cm",
"bottom": "1cm",
"left": "1cm"
},
"printBackground": true
}
}' \
--output document.pdf