In Uncategorized

Quick overview of how to get a basic django template into a PDF with styling an dynamic content.

Source Code: https://github.com/divanov11/Render-HTML-to-PDF-with-Django

Overview

  1. pip install
  2. Create Template
  3. Views.py imports
  4. Create render_to_pdf() function
  5. pdf view
  6. Add to urls.py
1 – Pip Install “xhtml2pdf “

Using Python 3:

pip install –pre xhtml2pdf

Using Python 2:

pip install xhtml2pdf

2 – Create Template

3 – Make required imports in views.py

4 – Create render_to_pdf() function

5 – pdf view

6 – Add to urls.py

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.