3

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.

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
BDeveloper
  • 1,175
  • 6
  • 24
  • 44
  • The true solution is not in the duplicate, since Helvetica is **not** a font you like to use, but in defining a default style see my [answer](http://stackoverflow.com/a/36518832/5292302) below – Petter Friberg Apr 09 '16 at 15:28
  • @AlexK this is not the same exception is get. – BDeveloper Apr 10 '16 at 10:01

2 Answers2

1

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.

sanluck
  • 1,544
  • 1
  • 12
  • 22
0

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.

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109