Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!


Project Description

## What is this

This is a class based mixin to download a class based view as a PDF.

The PDF is generated with firefox and selenium **(tested on ubuntu 14.04 LTS)**.

This is not really performant but generates good PDF's with selectable text.

This is how this is done:

## Example usage:

class InvoiceDetail(PdfDownloadMixin, TemplateView):
template_name = "invoice_print.html"
# PDF mixin attributes
pdf_filename = 'invoice.pdf'


## Options:


The filename of the PDF file download.

Default: *download.pdf*


The folder where the pdf files are saved.

Default: *'/tmp/'*

If true then created files are removed after creation.

Default: *True*

Authenticate the request to fetch the webpage for print *(current user of PDF download request is used)*
Default: *True*

Default: *2* seconds

GET parameter to indicate file should be downloaded as pdf: *(Example: willl download page as PDF)*
Default: *'pdf'*

## Installation

$ pip install django-pdf-download
System requirements tested on (ubuntu 14.04):
sudo apt-get install firefox xvfb cups-pdf

*cups-pdf* is only used once to setup headless printing (quirk in firefox you can not save as PDF unless you printed via another printer at least once).

You can do this by running the following command (available after installation of the package):

$ activate_headless_print

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


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
django-pdf-download-0.3.0.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None Oct 27, 2015

Supported by

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