Skip to main content
## 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:
```python

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

```

## Options:

**pdf_filename**

The filename of the PDF file download.

Default: *download.pdf*

**pdf_folder**

The folder where the pdf files are saved.

Default: *'/tmp/'*

**pdf_remove_file**
If true then created files are removed after creation.

Default: *True*


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

**pdf_load_time**
Default: *2* seconds

**pdf_get_param**
GET parameter to indicate file should be downloaded as pdf: *(Example: http://mysite.com/mypage/?pdf 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
```

Metadata

Release files for django-pdf-download 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-pdf-download 0.3.0
File Size Uploaded Provenance Actions
django-pdf-download-0.3.0.tar.gz 4.7 kB Without provenance Details for django-pdf-download-0.3.0.tar.gz

Release files / django-pdf-download-0.3.0.tar.gz

Download URL django-pdf-download-0.3.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e951fa382fa964301e4edad936d7e33912d8d65287622650819bff807863ca6f
BLAKE2b-256 checksum
How to use checksums
934350da1994ee4e6a9954b9eb1f3720660dc4ec8d8d906434074739e846aa57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-pdf-download 0.3.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page