Skip to content

Instantly share code, notes, and snippets.

@gaboelnuevo
Created August 1, 2017 07:01
Show Gist options
  • Save gaboelnuevo/78f0395a27836e514a5cccf696697fe2 to your computer and use it in GitHub Desktop.
Save gaboelnuevo/78f0395a27836e514a5cccf696697fe2 to your computer and use it in GitHub Desktop.
js-report-example
var jsreportConfig = config.getKey("jsreport", null, null);
if(!jsreportConfig){
console.log("jsreport config not found")
return res.status(500).end();
}
var jsreport = require("jsreport-client")(
jsreportConfig.url,
jsreportConfig.username,
jsreportConfig.password
);
jsreport.render({
template: req.invoice.template || jsreportConfig.templates.invoice,
data: req.invoice
}, function(err, response) {
if (err) {
console.log(err);
return res.status(403).end();
}
response.pipe(res);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment