UNKNOWN
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:
```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
```
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
```
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
File details
Details for the file django-pdf-download-0.3.0.tar.gz
.
File metadata
- Download URL: django-pdf-download-0.3.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e951fa382fa964301e4edad936d7e33912d8d65287622650819bff807863ca6f |
|
MD5 | d9f0cfd1e5090103e8fec2ca2701f937 |
|
BLAKE2b-256 | 934350da1994ee4e6a9954b9eb1f3720660dc4ec8d8d906434074739e846aa57 |