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.
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.