This is a microservice which handles pdfkit (which uses wkhtmltopdf) to make PDF generation from HTML a piece of cake.
docker run -d --name wkhtmltopdf-aas -p <hostport>:80 ciricihq/wkhtmltopdf-aas
Builds are automatically generated from github.
pip install -r requeriments.txt
python app.py
docker build -t ciricihq/wkhtmltopdf-aas .
docker run -d --name wkhtmltopdf-aas -p <hostport>:80 ciricihq/wkhtmltopdf-aas
curl -F "url=http://cirici.com" 'http://localhost:5000/pdf' > youramazingfile.pdf
curl -F "[email protected]" 'http://localhost:5000/pdf' > youramazingfile.pdf
curl -F "html=<html><head> <meta charset%3D\"utf8\"> </head><body>Hello world</body></html>" 'http://localhost:5000/pdf' > youramazingfile.pdf
You can use all the wkhtmltopdf options passing in a options array as following example (if option should not receive value just send the option without value):
curl -F "url=http://cirici.com" -F "options[orientation]=Landscape" -F "options[grayscale]" 'http://localhost:5000/pdf' > youramazingfile.pdf
You want to generate images? No problem, just change the pdf
endpoint to jpg
.