/django-wkhtmltopdf

Django Wrapper to the PDF Renderer: wkhtmltopdf

Primary LanguagePythonBSD 2-Clause "Simplified" LicenseBSD-2-Clause

django-wkhtmltopdf

Latest version Travis-CI Number of PyPI downloads on a month

Converts HTML to PDF

Provides Django views to wrap the HTML to PDF conversion of the wkhtmltopdf binary.

Requirements

Install the wkhtmltopdf static binary.

This requires libfontconfig (on Ubuntu: sudo aptitude install libfontconfig).

Python 2.6+ and 3.3+ are supported.

Installation

Run pip install django-wkhtmltopdf.

Add 'wkhtmltopdf' to INSTALLED_APPS in your settings.py.

By default it will execute the first wkhtmltopdf command found on your PATH.

If you can't add wkhtmltopdf to your PATH, you can set WKHTMLTOPDF_CMD to a specific executable:

e.g. in settings.py:

WKHTMLTOPDF_CMD = '/path/to/my/wkhtmltopdf'

or alternatively as env variable:

export WKHTMLTOPDF_CMD=/path/to/my/wkhtmltopdf

You may also set WKHTMLTOPDF_CMD_OPTIONS in settings.py to a dictionary of default command-line options.

The default is:

WKHTMLTOPDF_CMD_OPTIONS = {
    'quiet': True,
}

Documentation

Documentation is available at http://django-wkhtmltopdf.readthedocs.org/en/latest/.

License

MIT licensed. See the bundled LICENSE file for more details.