Using JSReport for automatic generation of reports



  • Hello there,

    I am from SIEMENS and I am doing a feasibility analysis of using JSReport for our product.

    We have a requirement of automatic generation of PDF reports from the data stored in database.
    We already have an angular app for visualizing these data in a web app. We are using Angular-material components and HighCharts for visualizing the data.

    Now we have to create PDF report AUTOMATICALLY (when the web app is not open) with the same look and feel.
    This means we have to somehow use the same angular components in the JSReport.

    What is the best practice of achieving this?
    Can someone please guide me?

    TIA.

    Regards,
    Saikat



  • Probably, the most straightforward approach is sending to the jsreport url of your app and let it convert html to the pdf. Such request looks like this

    POST http://jsreportapp.com/api/report
    {
        "template": {  
            "content": " ",
            "engine": "none",
            "recipe": "chrome-pdf",      
            "chrome": { "url": "http://siemensreporting.com/particularpage" }
        }     
    }
    

    In this case jsreport downloads the html from you app, evaluates javascript and responds with pdf that should look very much your app. jsreport app would be stateless as you don't need to store any templates or entities there.

    This could the shortest path to reach your goals. However, on the other hand, you won't be able to use the full power of jsreport. Instead, you may end up with more complex solution and rewrite or copy your angular/styles/html to the jsreport as entities and keep the reporting separated. You should think it through during your analysis.



  • Hi @jan_blaha Thanks for your response.

    My initial idea is, we have to create the template/styles with same look and feel in JSReport studio, spin up the JSReport server and then call a REST API to JSReport to trigger the Report generation (We dont want to use JSReport scheduling as we want to perform some custom logic to decide when is the ideal time to generate report).
    What do you think about this idea?

    As you said, in your proposed solution, we are really not using JSReport. In this approach, PDF can even be generated by any html-to-pdf converter.

    What do you mean when you say "Instead, you may end up with more complex solution and rewrite or copy your angular/styles/html to the jsreport as entities and keep the reporting separated." Could you please elaborate?

    I would love to have a meeting with you to understand the full power of JSReport and its several extensions. Following them over documentation is very difficult and you miss many important stuffs. Can we arrange such a meeting? It will be very helpful to us.

    Thanks in advance.



  • My initial idea is, we have to create the template/styles with same look and feel in JSReport studio, spin up the JSReport server and then call a REST API to JSReport to trigger the Report generation (We dont want to use JSReport scheduling as we want to perform some custom logic to decide when is the ideal time to generate report).
    What do you think about this idea?

    Yes, this is the best in most of the cases.

    As you said, in your proposed solution, we are really not using JSReport. In this approach, PDF can even be generated by any html-to-pdf converter.

    jsreport has even in this form additional features that html-to-pdf converts don't support like pdf merge. However, still, you are right that you wouldn't be really using jsreport.

    What do you mean when you say "Instead, you may end up with more complex solution and rewrite or copy your angular/styles/html to the jsreport as entities and keep the reporting separated." Could you please elaborate?

    I meant the same as you with your initial idea. That you create templates with the same look and feel in the jsreport studio.

    I would love to have a meeting with you to understand the full power of JSReport and its several extensions.

    We try to avoid calls and instead focus our time here on the forum because it is beneficial for the majority and not just individuals. If you need faster progress and discuss on phone, you can always purchase the starter support and we can organize a call as soon as it fits you.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.