13

I'm using IcePDF library to display PDFs in the web application. Under Java 6 (jdk1.6.0_37 32bits), fonts are displayed incorrectly (are substituted with some default font)

Java 6

while under Java 7 it looks ok.

Java 7

I need to use Java 6 in my app, have you got any idea what could be the cause of this behavior?

Odarpi
  • 131
  • 4
  • 1
    Is the IcePDF code that generates these two PDFs running on the same computer (with Java6 and Java7 installed)? – Jason Sperske Jan 17 '13 at 17:41
  • 1
    Yes, I'm running the app under JBoss on my development PC and I only switched from JRE 6 to JRE 7. – Odarpi Jan 17 '13 at 21:46
  • 1
    According to slides 38 and 39 of this: http://donaldojdk.files.wordpress.com/2011/11/55j7.pdf there are some new font types supported. Maybe the font that is working is a OpenType/CFF font and in Java6 it is falling back to a default font – Jason Sperske Jan 17 '13 at 22:24
  • 2
    The first slide uses the wrong font *glyphs*, but the right font metrics - that is each characters is placed in exactly the same position as for Java 7. This shows that either the PDF itself positions each character, or the font has partially, but not completely, loaded in Java 6. Sorry not an answer, but may assist in debugging. – Andrew Alcock Jan 22 '13 at 05:21
  • 1
    Can you provide a link to the PDF used for the illustrations? – Kurt Pfeifle Jan 25 '13 at 14:49
  • You can find it here: http://www.fsa.gov.uk/static/pubs/cp/cp12-37.pdf – Odarpi Jan 28 '13 at 10:01

3 Answers3

3

you can always import the fonts to your library..

You can try with this:

Font font = Font.createFont(Font.TRUETYPE_FONT, fontStream);

Next,

GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font);

And,

new Font("nameOfFont", Font.BOLD, 13)
Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
2

ICEpdf Pro supports OpenType/CFF fonts. If your having problems with font substitution in the Open source version then try installing the following fonts on your server instance. http://www.icesoft.org/wiki/display/PDF/Optimized+Font+Substitution

pcorless
  • 146
  • 4
1

Below steps may help you.I hope you are getting this in RedHat OS.

  1. Copy required font files to \Java\jre6\lib\fonts\ directory of below build version.
  2. Set the Java & JRE to this build and test it.

    java version "1.6.0_15" Java(TM) SE Runtime Environment (build 1.6.0_15-b03) Java HotSpot(TM) Server VM (build 14.1-b02, mixed mode)

I anticipate your problem will solve.

Jordan Reiter
  • 20,467
  • 11
  • 95
  • 161
Anil
  • 1,470
  • 5
  • 24
  • 35