wkhtmltopdf server with transparent drop-in client
10K+
A wkhtmlpdf server with drop-in client.
Why?
The server is not meant to be exposed to untrusted clients.
Several attack vectors exist (local file access being the most obvious). Mitigating them is not a priority, since the main use case is to use it as a private service.
A web server accepting wkhtmlpdf options and files to convert as multipart form data.
It is written in go.
A drop-in replacement for wkhtmlpdf which invokes
the above server defined in the KWKHTMLTOPDF_SERVER_URL environment variable.
There are two clients:
requests library.
It should work with any python version supported by requests.$ docker run --rm -p 8080:8080 acsone/kwhkhtmltopdf
or
$ go run server/kwkhtmltopdf_server.go
The server should now listen on http://localhost:8080.
$ go build -o client/go/kwkhtmltopdf_client client/go/kwkhtmltopdf_client.go
$ env KWKHTMLTOPDF_SERVER_URL=http://localhost:8080 \
client/go/kwkhtmltopdf_client https://wkhtmltopdf.org /tmp/test.pdf
or
$ env KWKHTMLTOPDF_SERVER_URL=http://localhost:8080 \
client/python/kwkhtmltopdf_client.py https://wkhtmltopdf.org /tmp/test.pdf
This should generate a printout of the wkhtmltopdf home page to /tmp/test.pdf.
KWKHTMLTOPDF_SERVER_URL environment variable.tox.This will run the same tests against the the native wkhtmltopdf executable, as well as against the server using the python and go clients.
See issues on GitHub as well as some TODO's in the source code.
Push the master branch and ensure tests pass on travis.
Create and push a git tag.
Travis will create a GitHub release with the client and server binaries.
Docker Hub will build the images.
Author: [email protected].
Contributors:
MIT
Content type
Image
Digest
Size
111.5 MB
Last updated
over 6 years ago
docker pull acsone/kwkhtmltopdf