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.
Source Distribution
headless_pdfkit-0.1.5.tar.gz
(2.0 kB
view details)
File details
Details for the file headless_pdfkit-0.1.5.tar.gz.
File metadata
- Download URL: headless_pdfkit-0.1.5.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fd24c5ca8b51d5f55aae3732010824b568c2de4141ca9853e7bf6169c194250
|
|
| MD5 |
48979ef806311799de6e85e7af269098
|
|
| BLAKE2b-256 |
b4f18122c31a21be0fb29e2e609d31493bd910240c990faf78676fe357b0d7bf
|