pyreportjasper icon indicating copy to clipboard operation
pyreportjasper copied to clipboard

PDF report generated from python using pyreportjasper is different from JasperSoft Studio

Open DTDKCWong opened this issue 1 year ago • 3 comments

I used Javasoft Studio to design a report by using JSON as the data source. Doing some formatting on the fields as below:

image

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.

image

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

DTDKCWong avatar Nov 16 '23 04:11 DTDKCWong

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 avatar Nov 30 '23 10:11 rawsid11

@DTDKCWong

I used Javasoft Studio to design a report by using JSON as the data source. Doing some formatting on the fields as below:

image

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.

image

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.

jadsonbr avatar Dec 29 '23 10:12 jadsonbr

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.

jadsonbr avatar Dec 29 '23 10:12 jadsonbr

Closed due to lack of engagement.

jadsonbr avatar Apr 15 '24 12:04 jadsonbr