Add and use fonts with pyreportjasper

15 Views Asked by At

I use Jaspersoft Studio (6.19.1) to design reports in jrxml to export to PDF using python (3.7) and pyreportjasper module. When I design the report I can use a lot of fonts (I suppose that I can use all the fonts that are installed in the OS). The problem is when I export to a PDF file, the font that is printed is always the same (I suppose that it is the default font). What I want to do is use another font to print the report in the server. But we don't have a jasperserver, we only have python and java in a jboss environment. My TexfFields in jrxml with Century Gothic font:

My python code:

input_file_main = "{}_p.jrxml".format(p)

input_file = str(input_file_main).replace('jrxml','jasper')

data_file = str(r / xml_file)

output = str(r / xml_file).replace(".xml","")
       
jasper = PyReportJasper()
    
jasper.config(
                input_file,
                output_file=output,
                output_formats=["pdf"],
                parameters={},
                db_connection={
                    'data_file': data_file,
                    'driver': 'xml',
                    'xml_xpath': 'Message',
                },
                locale='es_ES',
                resource=''
   )    
    
 

jasper.process_report()

How can I use the Century Gothic font or another one in the server? I tried to generate a font-extension jar but I don't know where to put in the server or how to connect it with the python script Thanks a lot

0

There are 0 best solutions below