Django views allow you to create much more than just HTML pages. You can create files of any type. For example, in the Exposing settings in JavaScript recipe in Chapter 4, Templates and JavaScript, our view provides its output as a JavaScript file rather than HTML. You can also create PDF documents for invoices, tickets, receipts, booking confirmations, and so on. In this recipe, we will show you how to generate handouts to print for each idea from the database. We are going to use the WeasyPrint library to make PDF documents out of HTML templates.
Generating PDF documents
Getting ready
WeasyPrint depends on several libraries that you need to install on your computer. On macOS, you can install them with Homebrew using this...