Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get JRRuntimeException: couldn't load the following font, Helvetica? [duplicate]

i'm using iReport 5.6 and JDK 6. when i call my report through my Java application this exception appears. i'm using a special font type and i have added to the iReport Libraries.

The Exception is:

**JRRuntimeException: couldn't load the following font:
pdfFontName: Helvetica
pdfEncoding: Identity-H
isPdfEmbedded: false**

I don't use this type of font, the font is use is special and I gave it a name "Arial" and i have imported it to the fonts library of the iReport. should I add this ttf file to java, and where? and why there exception about font I don't use.

like image 760
BDeveloper Avatar asked Oct 22 '25 13:10

BDeveloper


2 Answers

If you using Maven try to add fonts dependency to your pom.xml :

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

Otherwise, you need to add font what you need to your classpath.

like image 165
sanluck Avatar answered Oct 24 '25 09:10

sanluck


That is the default font that itext library use when you export to pdf.

To avoid this problem you need to define in your jrxml the default font to be used by setting default style

<style name="default" isDefault="true" fontName="DejaVu Sans"/>

Where fontName corresponds to a font that is included in your font-extension.

like image 44
Petter Friberg Avatar answered Oct 24 '25 09:10

Petter Friberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!