Created
August 1, 2017 07:01
-
-
Save gaboelnuevo/78f0395a27836e514a5cccf696697fe2 to your computer and use it in GitHub Desktop.
js-report-example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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