PDF reports in Python web applications — Part 2: Browser-based report template design

Image by Pexels from Pixabay

1. Installation

Jasper uses a client application (based on Eclipse and therefore requires Java Runtime Environment JRE) which exists for most operating systems and has to be installed locally. After starting the application you should be ready to create new report templates.

Place an empty DIV within the <body> of the web page
Initialize ReportBro Designer

2. Report Designer functionality

Jasper is a very powerful and feature rich tool. Jasper Client supports charts, sub-reports and many complex elements. While its capabilities are extensive it sometimes makes creating simple reports more complicated than it should be. Data queries are an integral part of most reports in Jasper and hence a deep understanding and knowledge of SQL is essential. But even for some simple tasks, like printing the current page in the footer (page x/y), you need to be aware of different types of expression evaluation. For us, and probably most Jasper novices, this was quite difficult to understand and get right in the beginning.

Jaspersoft Studio Report Designer
ReportBro Designer

3. Creating a report

A controller in our web application is responsible for creating reports. In case of Jasper the controller performs a web request to Jasper Server which is not accessible from outside. In the controller we also check if the user is authorized to generate a designated report. In case of downloading multiple reports, e.g. in a merged pdf or as a zip-file, these various requests cause an overhead and result in poor performance.

4. Test data and testing reports

Test data can be specified as part of the report in both solutions. Usually in Jasper you’ll connect to a database, so you’ll need to have a data source available as well for testing purposes. This makes testing much more difficult, especially when using a different Jasper server and database for local testing.

5. Updating reports

To update an existing report in Jasper you need to open the report in the client application and upload it to the server. This can be done within the Jasper Client once the server connection is initially configured. Because we have different reports for different customers this task is not only tedious but also error prone. That’s why we created a script to automate the report upload, along with specific tasks to create all report units and reports for a new customer. However, this still doesn’t help with report versioning which has to be done directly on the Japser server.

Report management within our web application

6. Report updates by application users

Our goal has always been to allow our application users to perform some minor report changes themselves. E.g. sometimes they simply want to modify the layout, change text formatting or add static text to a template.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store