4

jasperreports_extension.properties can use as external configuration file to customize default font and other parameters, however I found little document regarding how to integrate this file into Spring framework, i.e. from any method in this thread.

Basically I am trying to define the default fonts to my current Jasper report dynamically by jasperreports_extension.properties, I have everything works except don't know where to put this properties file and connect it with my Spring jasper bean.

Community
  • 1
  • 1
Dreamer
  • 7,333
  • 24
  • 99
  • 179

2 Answers2

4

Great news Dreamer! I managed to solve this problem.

What you need to do is add the jasperreports-fonts jar into your classpath, for example, using maven:

<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports-fonts</artifactId>
    <version>6.0.0</version>
</dependency>

This will take care of everything, however, you will only have the DejaVu font available. So in your report you can add the following to have bold fonts:

<font fontName="DejaVu Sans" isBold="true"/>

You can check the available font names inside the net.sj.jasperreports.fonts.fonts.xml file inside the jar. If DejaVu doesn't move your boat, you can always follow this guide for adding more fonts in the jar.

I truly hope this helps.

Kikin-Sama
  • 425
  • 3
  • 8
0

I was looking for the same thing and I feel that the answer is actually:

"Extension registry

JasperReports looks for available extensions by loading all the jasperreports_extension.properties files that it can find in the default package."

taken from documentation: http://jasperreports.sourceforge.net/api/net/sf/jasperreports/extensions/package-summary.html

kindest regards,

John (@codingdude)

coding-dude.com
  • 758
  • 1
  • 8
  • 27