Django views allow you to create much more than just HTML pages. You can generate files of any type. For example, you can create PDF documents for invoices, tickets, booking confirmations, and so on. In this recipe, we will show you how to generate resumes (curriculum vitae) in the PDF format out of the data from the database. We will be using the Pisa xhtml2pdf library, which is very practical as it allows you to use HTML templates to make PDF documents.
First of all, we need to install the xhtml2pdf Python library in your virtual environment:
(myproject_env)$ pip install xhtml2pdf
Then, let's create a
cv app containing a simple
CV model with the
Experience model that is attached to it through a foreign key. ...