JFreeChart objects into PDF and HTML documents

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Tom Mazzotta

JFreeChart objects into PDF and HTML documents

Post by Tom Mazzotta » Wed Feb 05, 2003 12:29 am

We are working on incorporating JFreeChart objects into PDF and HTML documents and see different options on how to do it.

I was wondering if anybody has any advice, words of caution, concerns, etc. about using any of the following techniques:

1. Save the chart as a PNG file and pull in this file
2. Save the chart as a JPG file and pull in this file
3. Save the chart as a SVG file and pull in this file
4. Embed the SVG stream directly into the final file.

... are there other options we should be considering?

... has anybody had success going the SVG route (either via a file and/or direct stream)?.. We've run into some strange quirks going this route thus far and don't want to force the issue if its not going to net any benefit.

... has anybody have success going the PNG file route?... My gut at this point says this is the easiest. Any problems/downsides with this route?

thanks in advance.

Hans Stössel

Re: JFreeChart objects into PDF and HTML documents

Post by Hans Stössel » Thu Feb 06, 2003 10:27 am

Hi

I convert the SVG file into PDF using ImageMagick/JMagick. But this rasterize it and the quality is not good until now. Another way would be using Batik/FOP from Apache, but I don't know how exactly.

Maybe we can find a solution together to produce good results. I inform you, if I find a solution.

Thanks

Hans

Ray Clough

Re: JFreeChart objects into PDF and HTML documents

Post by Ray Clough » Tue Feb 18, 2003 12:48 am

I've had good luck saving the chart as a JPEG in a temp file, and simply including the file in JSP pages by using the src="filename" attribute on the image tag. Although this does create a file on the server's hard disk, it is a temp file, and is deleted by the Operating System when the user session ends. I expect you could use a stream instead of a hard disk file, but that would have taken me more time to figure out.

- Ray Clough
ray.c.clough@boeing.com

Lanto

Re: JFreeChart objects into PDF and HTML documents

Post by Lanto » Tue Feb 18, 2003 9:25 am

Actually, I'm using JFreeChart and FOP for rendering PDF files including some charts.
For my work, the charts are rendered in JPEG files, and these filenames are included in the XML file which is used by FOP to generate the final PDF. This solution requires you have some knowledge about XSL-FO for the use of FOP.

By the way, with this solution, you can also choose to generate in SVG format instead of JPEG, FOP will be able to render it, by using Batik


Regards,
--
Lanto

Locked