Sources in jasperreports reports on wildfly

Asked

Viewed 1,479 times

0

I have a java web project that runs on a linux server. This project has reports created in Ireport with custom fonts, but these fonts are not displayed when I call the reports in this project. I already followed the tutorial exposed here How to change iReport generated PDF source? But even adding the JAR in the build path of the project the fonts are not recognized.

NOTE: I am exporting the reports in pdf, and when I created the font jar in Ireport I took care to mark the option to "embed" the fonts.
OBS2: I’m using common fonts like Times New Roman(I got the default font from a micro windows).

2 answers

0


I managed to solve my problem. I discovered that when creating the jar with fonts customized by Ireport or Jaspersoftstudio we cannot name fonts that have spaces. In my case for example I was creating a font with the name "Times New Roman". When I named the font as "Timesnewroman" it worked perfectly. Thus the tutorial described in the link How to change iReport generated PDF source? is correct, but just remember not to put spaces in the names of the sources.

0

In addition to the steps described in the reference included in the question, also include the src/main/Resources/fonts folder and within it copy from C: Windows Fonts the fonts you need to use in the report.

Also include the file in this folder a file called fontsfamily.xml containing:

<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
   <fontFamily name="Arial">
       <normal><![CDATA[fonts/arial.ttf]]></normal>
       <bold><![CDATA[fonts/arialbd.ttf]]></bold>
       <italic><![CDATA[fonts/ariali.ttf]]></italic>
       <boldItalic><![CDATA[fonts/arialbi.ttf]]></boldItalic>
       <pdfEmbedded><![CDATA[true]]></pdfEmbedded>
   </fontFamily>
</fontFamilies>
  • I did it the way you said it, but it didn’t work. I also created the jasperreports_extension.properties file and put it in src/main/Resources/ . My project is an EJB that runs inside an EAR on the server, I don’t know if it influences something.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.