Closed naphattharawat closed 5 years ago
A report definition is an object of type
{ jasper: // path to jasper file jrxml: // path to jrxml file conn: //connection name or definition }
One of jasper or jrxml must be present.
If that definition is made in general configuration options, you must name it, and you can use it like
jasper.pdf('name')
If you didn't define it in general options, you can still get the PDF by
jasper.pdf({ jasper: '/path/to/jasper/file', conn: 'connection name' })
Hope that cleared things.
Happy coding!
Forgot to mention, if you need to specify data, you can get PDF like this
jasper.pdf({ report: { jasper: '/path/to/jasper/file', conn: 'connection name' }, data: {} //data to pass to the report })
Cheers
app.get('/pdf', function (req, res, next) {
// file: xxx.jasper };
});