JFreeChart print job size.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
msprauer
Posts: 7
Joined: Wed Jul 11, 2007 5:02 pm

JFreeChart print job size.

Post by msprauer » Wed Jan 16, 2008 5:17 pm

I have noticed that when printing a Chart from the JFreeChart web start demo, that the print job shown in my print queue shows a size of 96.3mb. This seems to happen regardless of the Chart type, and is nearly always 96.3 mb.

To further investigate, I tried printing a Chart to a PDF writer (in my case Cute PDF), still, the print job shows a size of 96.3mb, but the resulting file is drastically less (200kb).

Has anyone noticed this problem. I mean, what determines the print job size? Surely it shouldn't be 96.3mb.

This seems to me to be a bug, any takers?

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

Post by david.gilbert » Wed Jan 16, 2008 5:43 pm

It's a while since I looked at the printing code, but in the past the most common problem has been *some* printer drivers seeing things like GradientPaint and anti-aliasing and only supporting these by creating bitmaps which can be very large at printer resolutions. I don't know any good solutions for that. But if you find any workaround, or the problem turns out to be something else, please post back here.
David Gilbert
JFreeChart Project Leader

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

shehriih
Posts: 5
Joined: Wed Jan 09, 2008 9:26 am

Post by shehriih » Wed Jan 23, 2008 9:38 am

i am having the same problem !

it only happen when i print to a PDF writer

if i print to the normal printer it is ok and the printout is so clear

but to PDF it is not as clear as the printout and has some broken lines

can u help on that

Alphonse87
Posts: 9
Joined: Thu May 08, 2008 3:18 pm

Post by Alphonse87 » Fri Jun 06, 2008 3:51 pm

If you want to get a PDF file which contains your charts, you can create it with the library iText.

raff
Posts: 1
Joined: Wed Jun 25, 2008 8:31 am

Post by raff » Wed Jun 25, 2008 8:55 am

Here's print job sizes that I've noticed when printing identical LineChart to few printers:

HP LaserJet 1320 (laser) - 640KB
Xerox Phaser 1235 (laser) - 15,9MB
Epson AL-C1900 (laser) - 4,25MB
Canon iP5300 (ink) - 63,7MB
PDFCreator - 60,7MB

Environment:
WindowsXP Professional SP3
jre 1.6.0_06
jfreechart 1.0.10
jcommon-1.0.13

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

Post by david.gilbert » Wed Jun 25, 2008 9:47 pm

Thanks for the numbers. Do they vary if the chart has antialiasing or not? And gradients?
David Gilbert
JFreeChart Project Leader

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

prassoon
Posts: 14
Joined: Fri May 23, 2008 1:57 am

Post by prassoon » Sun Jun 29, 2008 12:06 am

in my HP LaserJet (color) it takes about 15mb (right click on the chart and print)
I do have an SVG type chart generated out of JFreeChart and that one takes about 10-11mb.

Taqua
JFreeReport Project Leader
Posts: 698
Joined: Fri Mar 14, 2003 3:34 pm
Contact:

Post by Taqua » Sun Jun 29, 2008 11:40 am

The spool-file size is dependent on many factors:

(1) Your printer: Bitmap printer (Ink-Jet) or Vector printer (Laser printer; PCL and Postscript)
(2) Your printer driver
(3) Your JDK

When printing in Java, the JDK tries to map all Graphics2D operations directly into native rendering operations (vector-to-vector mapping). If that fails because your printed content contains non-vector stuff (like transparencies, images, gradients), then the JDK switches into a bitmap mode, where the whole content is rendered to a image and then the bitmap is printed. Usually, this bitmapped mode is what's causing the large spool files.

The JDK communicates with the printer driver, which in itself can choose to switch from vector to bitmap mode if it feels the need for it. Depending on how efficient the driver is, you may end up in a large whole-area bitmap or a mix up of vector and bitmap areas. Needless to say that with printer prices down to 150$ your chances of having a sane driver are down as well.

Depending on the JDK you use, you may see improvements in the printing - JDK 1.4 and 1.5 are nice, but suck big time compared to JDK 1.6.

prassoon
Posts: 14
Joined: Fri May 23, 2008 1:57 am

Post by prassoon » Sun Jun 29, 2008 6:50 pm

that make sense, thanks for the info Taqua

Locked