View source | Discuss this page | Page history | Printable version   

How to Change Fonts in Openbravo Reports



The objective of this article is to show you how to change the fonts used in Openbravo Reports. This can be useful in two cases:

Recommended articles

Before reading this guide, it is necessary to have a proper understanding of Openbravo's Modularity concept and how to create and package a module,
as we take the knowledge from these articles as a given in this guide.

In case you are working with reports on a regular basis, the following link to an article might be of interest to you, since it describes how to create a report.

Execution Steps

Openbravo uses two different tools to create reports:

With this, we need a different approach for each tool to change the font of the reports being generated by them. Both approaches will of course be explained here:

Changing the font in Jasper Reports

When changing the font in Jasper Reports, the software Jaspersoft Studio will be very helpful.

In the following link you can find a detailed tutorial that describes how to handle custom fonts in Jaspersoft Studio. In short, these are the steps we need to carry out:

View larger
View larger

Changing the font in FOP Reports

Not every report in Openbravo is designed as a .jrxml report. For example, the Price List Report is generated using FOP. The approach to change the font in this kind of reports is different; we don't need to change the report definition but make use of the FOP configuration file. These are the steps we must follow:

  1. Get the desired font's .ttf file from your system or download it from the Internet. For example: DejaVuSans.ttf
  1. The .fo reports used in Openbravo use the Helvetica font by default. To replace this font with the new one, we will modify the config/userconfig.xml file as explained here. So, we just add this new xml source snippet inside the <configuration> tags of the userconfig.xml file:
      <renderer mime="application/pdf">
         <font embed-url="/home/openbravo/DejaVuSans.ttf" kerning="yes"> 
           <font-triplet name="Helvetica" style="normal" weight="normal"/> 
           <font-triplet name="Helvetica" style="normal" weight="bold"/> 
           <font-triplet name="Helvetica" style="italic" weight="normal"/> 
           <font-triplet name="Helvetica" style="italic" weight="bold"/>

    Note that in this case we have our font placed in the path: /home/openbravo.

  2. Execute:
    ant smartbuild
  3. Restart tomcat

After this change, all .fo reports in the application will use the DejaVuSans font instead of Helvetica.


Following screenshots show the results after successfully carrying out the steps mentioned above:

First, we have a Jasper Report, where the font of the title has been replaced with another font:

View larger

And last, we have a FOP Report with the default font replaced:

View larger

Retrieved from ""

This page has been accessed 13,580 times. This page was last modified on 22 December 2017, at 16:28. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.