Render report using a template generated by studio...

  • Hi,
    I have template that I have created using the studio. Now, I just need to render reports using this template and pass it back to the frontend (angular). This is working perfectly fine.

    My question is, is it possible to render these, without starting the jsreport service using jsreport-core? Examples of jsreport-core state the following:

    jsreport.init().then(() => {
        template: {
          content: '<h1>Hello {{foo}}</h1>',
          engine: 'handlebars',
          recipe: 'chrome-pdf'
        data: {
          foo: "world"
      }).then((resp) => {
        // write report buffer to a file
        fs.writeFileSync('report.pdf', resp.content)    
    }).catch((e) => {

    If I have to follow this approach will I have to hard code the template here? Or is there a way to point it to the already available template?

    Thank you.

  • Did you install jsreport the normal way?
    So you have it running as a rest service?

    You typically have jsreport running as a rest service.
    Then you have a backend for your app where you communicate with jsreport using API, invoke rendering, and send the result to your frontend.

  • Thanks Jan. I was trying to get it working on ubuntu AWS ec2 without having to host the rest service, because my understanding was that it was only needed to access the template (since I'm calling jsreport.render(data) and not doing an http post). I'm still unsure of this, can you please clarify?

    I have got it working however with the rest service.

  • jsreport can be integrated in multiple ways

    • as an external service you communicate with using rest
    • as utility binary, you communicate with command line
    • directly integrated into your app backend when you use nodejs

    When you integrate jsreport in your nodejs application. You can also create templates with studio and use referenced templates during render. Try something like this in your app folder

    npm i jsreport-cli -g
    jsreport init
    jsreport configure

    This installs jsreport to your app, then you can start studio and prepare your templates

    jsreport start

    Then stop the studio, and integrate to your nodejs app. This is described in this documentation

  • OK got it. Thanks.

Log in to reply

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