If you are working on jasper report in spring boot then most likely you are having problem with the jasper report font rendering.
In general we can solve this problem by creating a jar file using the custom font and then add this jar as an external library in java build path in our project. And it will work fine in your local machine to generate a Pdf or Doc type file using jasper report.
But the problem will occur when you deploy your project in any hosting server then the server simply ignore the external library jar. And moreover, if you use spring boot to build your Restful API then it will be difficult. So today we wanna show you how to solve this problem.
- You have to add DynamicJasper-core-fonts as a maven dependency in your pom.xml
<dependency> <groupId>ar.com.fdvs</groupId> <artifactId>DynamicJasper-core-fonts</artifactId> <version>1.0</version> </dependency>
This dependency will take care to download jasper report fonts. This dependency supports so many fonts in jasper report but not all the fonts. And this will vary with your jasper report version. Some so well-known fonts will support to almost all the jasper report versions.
• Arial • Times New Roman • Courier New • Comic Sans MS • Georgia • Verdana • Monospaced • etc.
- After save and rebuild your project, you are good to go for the jasper report layout design and you can use your desire fonts.
That’s it for today. Thank you for reading. See you around. If you have any questions, you can ask me in the comment or mail me.