Generate Reports

In this section we’ll cover how to generate reports from the data we collect in our database using the clj-pdf library.[70] Then we’ll discuss how to serve the generated PDF to the browser using the appropriate response type.

Our application will have an employee table that will be populated with some sample data. We’ll use this data to create a couple of different PDF reports, and we’ll allow the users to select the type of report they wish to view. Let’s create a new application called reporting-example using the Luminus template.

 lein new luminus reporting-example +postgres

Now we open the project.clj file to add the clj-pdf dependency.

 :dependencies [...
  [clj-pdf ​"2.2.0"​]]

We also have to remember to update the ...

Get Web Development with Clojure, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.