Skip to main content

A headless version of pdfkit which makes use of xvfb-run

Project description

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.

The headless_pdfkit package tries to make the hotfix proposed by jakewins a bit easier to work with.

Installation

You can install headless_pdfkit by running:

pip install headless-pdfkit

Examples

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)

Save a simple PDF from string while passing the –auto-servernum parameter to xvfb-run.:

options = {
    'auto_servernum': ''
}

ret = generate_pdf('<html></html>', options=options)
with open('output.pdf', 'wb') as w:
    w.write(ret)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
headless_pdfkit-0.1.5.tar.gz (2.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page