🚀 Need a ready-to-deploy version?
Includes Docker, setup guide, sample responses, and full API structure.
This Flask-based API accepts raw HTML and returns a generated PDF. Useful for invoices, reports, or documents rendered from frontend.
- 🔁 Converts raw HTML to downloadable PDF
- 📬 POST endpoint:
/convert-html
- 🧻 Uses
pdfkit
(requires wkhtmltopdf) - 🐳 Dockerfile includes wkhtmltopdf
- 🧱 Minimal and fast
Request Body:
{
"html": "<h1>Hello PDF</h1><p>This is generated from HTML</p>"
}
Success Response:
- Returns binary PDF file with headers:
Content-Disposition: attachment; filename=converted.pdf
Content-Type: application/pdf
{ "error": "No HTML content provided" }
pip install -r requirements.txt
Also install wkhtmltopdf on your system if running locally:
sudo apt install wkhtmltopdf
Dockerfile installs wkhtmltopdf and runs the server:
docker build -t html-to-pdf-api .
docker run -p 5000:5000 html-to-pdf-api
Postman examples in /screens
.
Packaged and ready for deployment. Clean modular code + Docker + error handling:
- Email: talabov.ali72@gmail.com
- Telegram: @talabovali
Need this in another language (Node.js, Go)? Custom implementation available — just ask.