What is the jasperrepots-fonts jar for and how to use it?

前端 未结 1 1032
野的像风
野的像风 2020-12-25 08:12

i\'m evaluating JasperReports for report generation. I have some problems with report portability between Windows and Linux. I found a (hacky) solution to make it work cross

相关标签:
1条回答
  • 2020-12-25 09:06

    In jasper report (.jrxml file) you can use several fonts for displaying labels/texts. These fonts may not be always available on different platforms/OS. (e.g. There are some MS fonts which are unavailable on linux machines unless you install them manually). So, we bundle the fonts used in jasper report into a jar and make them work irrespective of underlying platform. Additionally, you can include your own (custom created) fonts in fonts extension jar and ship them along with jasper reports. More information is here.

    Also there are couple of ways to configure and use this jar. Have a look at this to know one of the easiest way.

    Note that if the font used in jrxml is not available in the JVM, it will throw an error while exporting the report as follows:

    net.sf.jasperreports.engine.util.JRFontNotFoundException:  
       Font 'Arial' is not available to the JVM.   
    

    This can be solved in 2 ways:
    1. Use jasperreport-extension.jar OR
    2. Set the property net.sf.jasperreports.awt.ignore.missing.font to true to ignore missing font. e.g. In jrxml, you can set it as follows:

    <property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
    
    0 讨论(0)
提交回复
热议问题