Jasper Report viewer for web based application.

0

Our web application uses Java  Rest services in the server side and the angularJS used in the client side. We are using community version of the Jasper report. The problem we are facing now is how to display the jasper report in the browser. Since a proper viewer for jasper report is not identified in the browser, we have implemented the below solution.
Server returns the jasper report in html format. Trust the html using angular $sce.trustAsHtml() and bind it using ng-bind-html directive. Thus, the report can be displayed in the browser.
After creating jasper report, the server saves jrprint file in database.
In the client side there is a option to export the report to PDF and EXCEL. When user select the export to PDF option, browser send another request to the server and pass the jrprint file name as parameter. The server identifies the jrprint saved in the database and export to PDF using JasperExportManager.
The jrprint file stored in the database is deleted periodically.

The jrprint is stored and re-used in the export to ensure that we have same data displayed in browser and in the exported file.
I would like to know, is there any issues with this approach?.  Do you know any better way to support view and export over web browser. I cannot use visualise.js as this is a community version.

Thanks in advance.

Alex4u's picture
3
Joined: Feb 22 2018 - 11:45am
Last seen: 6 months 3 weeks ago

2 Answers:

0

This sounds like a valid approach. Another way it could be implemented is using rest_v2/reports or reportExecutions services to produce PDF and Excel versions. You can use the Data Snapshots on the server side to "freeze" the data and avoid re-execution of the queries. You can then use report job scheduler to re-generate the data snapshots periodically to refresh the data.

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 2 days 54 min ago
0

Thank you @Friendly User.

We will analyse the rest_v2/reports  approach and let you know the result.

Alex4u's picture
3
Joined: Feb 22 2018 - 11:45am
Last seen: 6 months 3 weeks ago
Feedback