Skip to main content

Generate PDF from html templates and print, view or send via email

Project description

Sendpdf is a simple Django app that can be used to generate PDF documents from html templates.

It can handle images and css very well. The generated PDF can then be displayed in the browser for printing and saving.

Alternatively, one can send the PDF to one or many email addresses.

Has been tested with Django 3+. Versions prior to 2.0.0 has been tested with Django==1.9.

Detailed documentation is in the official page.

Checkout the latest code in the repo wanderijames/django-sendpdf and use docker and docker compose to test its functionality.

Quick start

  1. Install django-sendpdf:
$ pip install django-sendpdf
  1. Install wkhtmltopdf:
  • Debian/Ubuntu:
$ sudo apt-get install wkhtmltopdf

Warning! Version in debian/ubuntu repos have reduced functionality (because it compiled without the wkhtmltopdf QT patches), such as adding outlines, headers, footers, TOC etc. To use this options you should install static binary from wkhtmltopdf site or you can use this script.

  • Windows and other options: check wkhtmltopdf homepage for binary installers
  1. Add “sendpdf” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
        ...
        'sendpdf',
    )
    
  2. In your Django settings add the location of wkhtmltopdf, default location is /usr/local/bin/wkhtmltox/bin/wkhtmltopdf, like this:

    WKTHMLTOPDF_PATH = "/usr/local/bin/wkhtmltopdf"
    
  1. Include the sendpdf URLconf in your project urls.py like this:

    path(r'^sendpdf/', include('sendpdf.urls', namespace='sendpdf')),
    
  2. Run python manage.py runserver to see some demos:

    Template example

    View PDF inline

    Dewnload PDF

    Send PDF

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-sendpdf, version 2.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_sendpdf-2.0.1-py2.py3-none-any.whl (20.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-sendpdf-2.0.1.tar.gz (28.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page