Jasper Reports: Font extension not working
I had similar issue where IReport designer preview able to show the font with bold but not in downloaded report from Spring boot.
I added the following maven dependency and solved my issue. https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-fonts
A big thank you to @Tunaki for helping me to solve this issue.
The problem was solved by putting the jasperreports_extension.properties and the fonts folder in the root of the project like this:
Yeah, using simple xml font file worked for me. Here is fonts.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="Arial Unicode MS">
<normal><![CDATA[fonts/ARIALUNI.TTF]]></normal>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded><![CDATA[false]]></pdfEmbedded>
</fontFamily>
</fontFamilies>
Here is src\main\resources\jasperreports_extension.properties:
net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.myfamily=fonts/fonts.xml
Here is structure:
In your code, nothing need to do, just print in normal case, UTF-8 will work!