Public | Automated Build

Last pushed: 6 months ago
Short Description
Weasyprint (for creating PDFs) as a microservice
Full Description

docker-weasyprint

Weasyprint as a microservice in a docker image.

Usage

Run the docker image, exposing port 5001

docker run -p 5001:5001 aquavitae/weasyprint

A POST to port /pdf on port 5001 with an html body with give a response containing a PDF. The filename may be set using a query parameter, e.g.:

curl -X POST -d @source.html http://127.0.0.1:5001/pdf?filename=result.pdf

This will use the file source.html and return a response with Content-Type: application/pdf and Content-Disposition: inline; filename=result.pdf headers. The body of the response will be the PDF.

In addition /health is a health check endpoint and a GET returns 'ok'.

Docker Pull Command
Owner
aquavitae
Source Repository

Comments (1)
sanders76
a year ago

I'm wondering this could be used to not only send a file, but send a link to this service so this image can pull data from that link generating a pdf.
This could be convenient when you have external files in the html (like img or css files)