esoni
esoni

Reputation: 1362

Report pdf library for nodejs

is there a library for nodejs/javascript to create dinamically pdf report as Ireport jasper report in Java ? I need to create dinamically pdf report in my nodejs webapp. Thanks

Upvotes: 0

Views: 2295

Answers (2)

Jan Blaha
Jan Blaha

Reputation: 3095

You can use jsreport-core package for this

var jsreport = require('jsreport-core')()

jsreport.init().then(function () {     
   return jsreport.render({ 
       template: { 
           content: '<h1>Hello {{:foo}}</h1>', 
           engine: 'jsrender', 
           recipe: 'phantom-pdf'
        }, 
        data: { 
            foo: "world"
        }
    }).then(function(resp) {
     //prints pdf with headline Hello world
     console.log(resp.content.toString())
   });
}).catch(function(e) {
  console.log(e)
})

This just simply wraps javascript templating engines and html to pdf converters. However it adds also many features on top of it like visual designer which you can use.

PS: I'm the author of jsreport

Upvotes: 1

CherryNerd
CherryNerd

Reputation: 1314

I've used the combination of html-pdf and handlebars for that.
I generate an HTML report with handlebars and I let the html-pdf module generate a nice PDF from that.

Links:

HTML-pdf
Handlebars

Upvotes: 1

Related Questions