How to generate pdf file from jrxml and mysql

I want to generate report in pdf format. I need to use data from mysql database and use .jrxml for adding data to template.

I got reports using Jasper Studio. And I got a template in file format .jrxml.

At this moment I need to do similar process on linux server, using only terminal, without IDE and without Java projects

jedav's picture
Joined: Aug 13 2019 - 12:24am
Last seen: 3 years 1 month ago

1 Answer:

That's easy per Jasper API ....just

1.) load the jrxml and compile it to an JasperReport Object (or load directly the .jasper file instead) ,

2.) pass your connection and parameter to the FillManager and get an JRPrintObject out of the loaded template/report

3.) export the resulting JRPrint to a pdf-file

take a look into the samples provided in full JasperReports Project download zip file.

hth + regards


C-Box's picture
Joined: Jul 19 2006 - 5:58pm
Last seen: 5 months 3 weeks ago