python-wkhtmltopdf
NOTE: This has been FORKED FROM https://github.com/qoda/python-wkhtmltopdf because the Python package (https://pypi.org/project/wkhtmltopdf/) is no longer maintained, but there are still those in the community who need to use this for production projects in Python 3.
A simple python wrapper for the wkhtmltopdf lib (https://github.com/wkhtmltopdf/wkhtmltopdf)
Requirements
System:
Linux 32/64 or OSX only (Windows is not supported at this stage)
Xvfd
wkhtmltopdf
python 3+
Installation
wkhtmltopdf (Linux)
Install Xvfd:
$ sudo apt-get install xvfb
Install Fonts:
$ sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
Install wkhtmltopdf:
$ sudo apt-get install wkhtmltopdf
wkhtmltopdf (OSX)
Install wkhtmltopdf:
$ brew install wkhtmltopdf
python-wkhtmltopdf (Any Platform)
Development:
$ git clone git@github.com:jontsai/python3-wkhtmltopdf.git $ cd python3-wkhtmltopdf $ virtualenv . $ pip install -r requirements.pip
PIP:
$ pip install git+https://github.com/jontsai/python3-wkhtmltopdf.git or from pypi $ pip install python3-wkhtmltopdf
Usage
Simple Usage::
Use from class:
from wkhtmltopdf import WKHtmlToPdf wkhtmltopdf = WKHtmlToPdf( url='http://www.example.com', output_file='~/example.pdf', ) wkhtmltopdf.render()Use from method:
from wkhtmltopdf import wkhtmltopdf wkhtmltopdf(url='example.com', output_file='~/example.pdf')
Use from commandline (installed):
$ python -m wkhtmltopdf.main example.com ~/example.pdf
Use the api (installed):
$ python -m wkhtmltopdf.api & $ wget http://localhost:8888/?url=example.com&output_file=example.pdf
Required Arguments:
url - the url to convert to pdf
output_file - the pdf file that you want to create
Optional Arguments:
enable-plugins (default: True)
disable-javascript (default: False)
no-background (default: False)
grayscale (default: False)
orientation (default: Portrait)
dpi (default: 100)
username (default: None)
password (default: None)
margin-bottom (default: 10)
margin-top (default: 10)
margin-left (default: 10)
margin-right (default: 10)
disable-smart-shrinking (default: False)
Metadata
Release files for py3-wkhtmltopdf 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py3_wkhtmltopdf-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for py3_wkhtmltopdf-0.4.1-py3-none-any.whl |
Release files / py3_wkhtmltopdf-0.4.1-py3-none-any.whl
| Download URL | py3_wkhtmltopdf-0.4.1-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3a55dde7619d69043f006b7bb06a036f1bbcc7076d098f69536711020de9bcd
|
|
BLAKE2b-256 checksum How to use checksums |
a79cf91f9cfd7cf3c4b2bff5ab5314919ff5dbb9459f49b2310626c0cff700f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.54.0 CPython/3.8.5
|
Security for py3-wkhtmltopdf 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.