iText file size increase when using JFreeChart JDK 1.3.1_09

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jmoors
Posts: 7
Joined: Fri Jul 29, 2005 11:29 am

iText file size increase when using JFreeChart JDK 1.3.1_09

Post by jmoors » Sat Sep 03, 2005 9:32 pm

Thought I'd just post the solution to a problem which I've spent ages investigating, so it might help others.

I've written an application which uses iText and JFreeChart to generate reports via the web browser. I had developed the application locally on my machine running Java SDK 1.4 and was impressed when the file size was only 30K. However on deployment to a Portal Server running JDK 1.3.1_09 the file size increased 6 times to approximately 167K.

After hours of investigation I found that problem was due to a JFreeChart workaround for a Java Bug.

The TextUtilities class has a workaround for JDC bug ID 431217 for drawing vertical text. The workaround uses the TextLayout class to Render the text instead of the PDFGraphics2D.drawString method, and has the effect of increasing the size of my PDF file from 30k to 167k.

It seems for JDK 1.3.1_09 that we're using you do not need the workaround, so you can turn it off using the following method.

org.jfree.text.TextUtilities.setUseDrawRotatedStringWorkaround(false);

Thanks to Adriaan Joubert for info, saved me from spending any more time!

http://www.mail-archive.com/itext-quest ... 16646.html

Jason.

p.s Thanks for all you work David et al, JFreeChart is a wonderful example of well designed code, and has made my life easier. :D

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: iText file size increase when using JFreeChart JDK 1.3.1

Post by david.gilbert » Mon Sep 05, 2005 11:23 am

jmoors wrote:Thought I'd just post the solution to a problem which I've spent ages investigating, so it might help others.
Thanks. A lot of people do search the forum for solutions, so I appreciate you taking the time to add this information.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked