A headless version of pdfkit which makes use of xvfb-run
The PDFKit package makes use of wkhtmltopdf, which in turn needs an X Server to run. In Debian land, this generally requires xvfb-run wrapper.
You can install headless_pdfkit by running:
pip install headless-pdfkit
Save a simple PDF from string.:
from headless_pdfkit import generate_pdf ret = generate_pdf('<html></html>') with open('output.pdf', 'wb') as w: w.write(ret)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.