Torrone
Ruby client to JasperReports API.
Currently, only does compilation of JRXML files and generation of PDF reports.
Installation
After installing the gem:
gem install torrone
Usage
Before doing anything, you should configure Torrone:
Torrone::Config.configure do |config| config.jasper_dir = "/dir/of/reports" end
Having a compiled jasper file, you can generate a PDF report:
array_of_bytes = Torrone::Report.generate('emails', data: [ { email: 'foo@bar.com' }, { email: 'foo2@bar.com'}, { email: 'foo3@bar.com'} ] )
it returns an array of bytes.
You can also pass a hash of custom/specifics parameters, just like this:
array_of_bytes = Torrone::Report.generate('emails', data: [ { email: 'foo@bar.com' }, { email: 'foo2@bar.com'}, { email: 'foo3@bar.com'} ], params: {'COMPANY_NAME' => 'My company name'} )
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request