To use, POST
some HTML to localhost:5001/pdf
. The response will be a rendered pdf file.
A GET
to localhost:5001/status
should result in an ok
response.
A GET
to localhost:5001/version
should output the weasyprint version (currently 0.47
).
In order to make fonts available to weasyprint, simply copy them into ./fonts
and build the image.
This is a very simple Dockerfile based on Alpine Linux.
It creates a very small (105MB+) weasyprint service.
It uses a wsgi server by aquavitae to provide weasyprint as a web service.
You can run flask api localy by creating a .env
based on .env.example
and just run vscode debbuger by typing f5
.
By the way, you need install weazyprint dependencies to run localy and install all libs on requirement.txt
.
Your console output will be like this:
* Tip: There are .env files present. Do "pip install python-dotenv" to use them.
* Serving Flask app "app/server.py"
* Environment: development
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
You can create the docker just typing:
> docker-compose -f "docker-compose.yml" up -d --build
Docker and docker-compose.
Convert large html files into pdfs.
👷
👷
- Dave Rosborough - Initial work - Github
- Douglas Eleutério - Convert pdf from S3 - Lett Digital
This project is licensed under the GNU License - see the LICENSE file for details