JasperReports does not generate report with bold

前端 未结 1 997
情深已故
情深已故 2020-12-06 15:27

I have read JasperReports - Fonts Sample (version 6.2.0) official tutorial to generate my reports the same way they were designed with font styles.

Here\'s my

相关标签:
1条回答
  • 2020-12-06 15:53

    You need to have the correct path to your xml and ttf files, it follows same style as java package.

    Example

    If your jasperreports_extension.properties is in the project root folder (that I would suggest since it need to be found by jasper-reports) and you have the fonts.xml and ttf files in a folder that are called fonts.

    The reference in jasperreports_extension.properties would be:

    net.sf.jasperreports.extension.simple.font.families.myFonts=fonts/fonts.xml
    

    And in fonts.xml

    <fontFamily name="DejaVu Sans">
        <normal>fonts/DejaVuSans.ttf</normal>
        <bold>fonts/DejaVuSans-Bold.ttf</bold>
        .....
    </fontFamily>
    

    If you still have problem I suggest that you use an IDE like ireport or jaspersoft-studio they will let you automatically generate a jar for the font-extension (including your ttf's).

    It will then be enough that you included this jar in your classpath when generating your pdf export.

    How to generate font extensions jar using iReport or in JasperSoft Studio

    0 讨论(0)
提交回复
热议问题