[SOLVED] Recommandation about the way to integrate Jasper Reports



I'm new to Jasper Reports and I would like to ask for some recommandations.


I used JasperSoft Stdio to design a report using an XML data source.

The XML file I used to create my Data Adapter is simply a sample file from which I defined the fields. However the target is that several users of a business application will input batches of data, and at th end of each batch, an XMLfile will be produced.


What I would like to send the XML to Jasper Reports and  instruct it to generate the report. Ideally, I would like to send the data via HTTP (using curl or something similar, and get my PDF report back as a response). The goal is to produce the report immediately when the XML file is produced, ant automatize the whole process.


What would be your recommandation to achieve this , given that the business application is an old fashion app and cannot integrate Java libraries, and that, in my context, developping an intermediary layer in Java is not an option. I may be able to develop an intermediary layer in Python only.


Thank you in advance for you precious help.


Best regards


Koyyote's picture
Joined: May 16 2013 - 11:52am
Last seen: 2 years 9 months ago

1 Answer:

In my opinion, just create a Python application, then import your PDF template design using Jasper report, transfer your data using parameters instead of fields and you will get the PDF as the result.

Firstly, design a template using Jasper Report Studio. You will get the jrxml file.

Secondly, for the import template to the Python application, I found this: https://pypi.org/project/pyreportjasper/

Finally, transfer your data using parameters instead of fields. As you can see in the above link, when running the jasper.process(), they pass an object containing a property is parameters. parameters property is a map object with the key is string and value is any type you want. Define a parameter in your PDF template and you can use it in your template. You can receive the data via HTTP request and pass the data to PDF template through parameters.

I am Leo's picture
Joined: Jan 3 2020 - 3:13am
Last seen: 11 months 2 weeks ago



Thank you very much for your answer. I made some tests, and it seems to be exactly what I needed.

I'll make more advanced tests to see if I can move on with this solution.


I just have a problem with it : In JasperSoft Studio, I created a Data Adapter in which I specified that input date format is "dd/MM/yyyy". In my jrxml, I defined a field with type java.util.date. This enables me to modify the date format when I put in on my report.

However, with pyreportjasper, the Data Adapter is useless. So I didn't find the way to specify the input date format, and got a "unparseable date" error....

So I modified the type of my date field to java.lang.String. However, it makes the format conversion heavier.


Beside this, with the simple report I tested, it works fine.


Thanks again for your help.

Koyyote - 3 years 4 months ago