Django view that converts HTML to PDF using webkit.
Project description
Django view that converts HTML to PDF using webkit - via pdfkit and wkhtmltopdf.
Prerequisites
You need to install wkhtmltopdf.
The versions in Debian/Ubuntu repositories (installed using apt-get install wkhtmltopdf) have reduced functionality and you will most likely want to install one of the stable binaries provided at http://wkhtmltopdf.org/downloads.html which provide increased functionality (headless, patched Qt, better rendering support).
Installation on Ubuntu is as simple as;
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar -xf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
sudo cp wkhtmltox/* /usr/
Install
pip install django-pdfkit
Usage
Simply use the class based PDFView which is a drop in replacement for TemplateView.
# urls.py
from django_pdfkit import PDFView
...
url(r'^my-pdf/$', PDFView.as_view(template_name='my-pdf.html'), name='my-pdf'),
...
Then in your browser goto http://localhost:8000/my-pdf/ and it will magically render as a PDF.
See the docs for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_pdfkit-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03a8797242ae62d02b81490df561a309e6e298ae580ebff1beb2e2654ff7f446 |
|
MD5 | 2bf84afb114434d60b3ca691394f1ad4 |
|
BLAKE2b-256 | 47bd528acd88bcf412b7150b0aecd4a9754d1c64126b9041a244659dd1c0f32b |