pyreportjasper
pyreportjasper copied to clipboard
PDF report generated from python using pyreportjasper is different from JasperSoft Studio
I used Javasoft Studio to design a report by using JSON as the data source. Doing some formatting on the fields as below:
I then wrote a Python program to use PyReportJasper to generate the PDF report by using the same jrxml file as I used in the Javasoft Studio. However, the output doesn't match the output in Studio. The format is messy.
The comma of the thousand separator is showed as a full stop. The % format is totally a mess.
I use Jaspersoft Studio 6.20.6, PyReportJasper 2.1.2
Any one has come across the same issue?
KC
can you share the code? Because I am getting error in this code :import os
#import pyreportjasper
#from io import StringIO
#from pyjasper.jasperpy import JasperPy
from pyjasper.jasperpy import JasperPy
def compile_and_process():
# Compilation
input_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'C:\\Users\\Report_20102023.jrxml')
print(input_file)
jasper = JasperPy()
compiled_file = jasper.compile(input_file)
# Processing
output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'output')
jasper.process(compiled_file, output=output_dir, format_list=["pdf", "rtf"])
if __name__ == "__main__":
compile_and_process()
error : Import "pyjasper.jasperpy" could not be resolved
@DTDKCWong
I used Javasoft Studio to design a report by using JSON as the data source. Doing some formatting on the fields as below:
I then wrote a Python program to use PyReportJasper to generate the PDF report by using the same jrxml file as I used in the Javasoft Studio. However, the output doesn't match the output in Studio. The format is messy.
The comma of the thousand separator is showed as a full stop. The % format is totally a mess.
I use Jaspersoft Studio 6.20.6, PyReportJasper 2.1.2
Any one has come across the same issue?
KC
I believe that when you tested it, you hadn't saved the .jrxml file in Jaspersoft Studio because, looking at the attached image, it still has the * in the file. Also, try using the new version 2.1.3.
can you share the code? Because I am getting error in this code :import os
#import pyreportjasper #from io import StringIO #from pyjasper.jasperpy import JasperPy from pyjasper.jasperpy import JasperPy def compile_and_process(): # Compilation input_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'C:\\Users\\Report_20102023.jrxml') print(input_file) jasper = JasperPy() compiled_file = jasper.compile(input_file) # Processing output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'output') jasper.process(compiled_file, output=output_dir, format_list=["pdf", "rtf"]) if __name__ == "__main__": compile_and_process()
error : Import "pyjasper.jasperpy" could not be resolved
@rawsid11
It seems like your imports are commented out. Another issue is that the library imports themselves do not correspond to pyreportjasper
.
Closed due to lack of engagement.