JasperReports example

I have created a simple Maven/Spring Boot project to demonstrate how to generate a PDF report using JasperReport library. Although it is a simple example I decided to use Jasper sub-report approach, thus I give an example on how to build more complex reports.

I also chose to use a SQLite database to provide the report data. It is a very simple database containing only one table. Since the project is using the DAO design pattern, you can adapt it to use another database without much effort.

If you just want to run this example, you don’t need any IDE (Eclipse/Netbeans/IntelliJ). Assuming you are running Linux, you just need these following lines:

1
2
3
4
$ git clone https://github.com/sergiodurand/jasper-examples.git
$ cd jasper-examples
$ ./mvnw spring-boot:run
$ xdg-open /tmp/report.pdf

For more technical details about this project or if you want to get access to the source code, go the the jasper-examples Github repository.

Share Comments