-1

I am working on jasper reports to produce PDF file.

I have problem that is Font format exception when I run program which generates PDF on linux OS machine. I have used Times new roman font format for jasper file and linux OS does not support Times new roman, can anyone suggest me common font format for linux and windows OS to create jasper file .

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
Robert
  • 65
  • 3
  • 12
  • 2
    You need to add your own font files to your app and use those fonts, if you want to be independent from the fonts provided by OS. – Jozef Chocholacek Sep 08 '16 at 11:13
  • 1
    I assume you used google first - I just did, and found http://lists.apple.com/archives/webobjects-dev/2011/Sep/msg00192.html for "jasper fonts cross-OS", which links to instructions on https://github.com/wocommunity/wonder/commit/3252276338c323256065be95ad1f5d3a5b95fc2c -- did that not work? – Mike 'Pomax' Kamermans Sep 08 '16 at 19:47

1 Answers1

1

Java defines the following five logical font families:

  • Dialog
  • DialogInput
  • Monospaced
  • Serif
  • SansSerif

This means that these fonts are always available in java runtime, however they are not actual font libraries but mapped by java to some font installed on system. Hence using any of these font will not cause any error in java.

However, you are exporting to pdf that instead have what is called Standard Type 1 fonts as you can see there is no match and iText (the lib creating the pdf) will use if not defined the default font Helvetica.

The conclusion is that while using a logical font, which would not throw an errors this could lead to report inconsistency in pdf (using another font).

The solution in jasper-reports is to use font-extensions

Graham
  • 7,431
  • 18
  • 59
  • 84
Petter Friberg
  • 21,252
  • 9
  • 60
  • 109