Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Batik and FreeHep

Thread Tools

Batik and FreeHep

Glenn Thomas Hvidsten
Posts: n/a

I've recently found the batik and freehep libraries which mostly do
exactly what I need; to load an SVG document and convert it to another
vector graphics format (.cgm or .pdf).
My problem is that freehep only use a standard Graphics2D-enabled
component (i.e. JComponent) to be able to export. Batik, however, only
outputs images to it's custom JSVGCanvas, which is not directly
compatible with freehep.
Using only a JComponent which I draw to myself using the paint() method
I've gotten freehep export to work by using this syntax:

VectorGraphics vg = new PDFGraphics2D(
new File("temp.pdf"),
new Dimension(x,y));

where 'super' points to the class extending JComponent.

I've also managed to draw an image based on an SVG file using the
example on this page:

Using that example I added another button and added this in the
actionPerformed method for that button:

VectorGraphics vg = PDFGraphics2D(
new File("test.pdf"),

This syntax gives a couple of NullPointerExceptions.

I also tried to use the graphicsnode of the SVGCanvas by using this syntax:


but this gives these two error messages:

PDFWriter: PDFRef 'Paint0' is used but not defined.
PDFWriter: PDFRef 'Paint1' is used but not defined.

Does anyone have any experiences with these libraries, or other similar
libraries that will do the same thing? I really need this converter to
work as soon as possible. I'm kinda on a deadline here
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on JFreeChart and Batik Shripathi Kamath Java 0 11-26-2003 01:17 AM
Apache Batik - Question on editing SVG file and transform the graphics to other formats (e.g. JPG, PNG...) Brian K Java 0 10-12-2003 03:44 PM
Apache Batik - Question on editing SVG file and transform the graphics to other formats (e.g. JPG, PNG...) Brian K XML 0 10-12-2003 03:44 PM
problem using Batik + JFreeChart Lordy Java 1 09-13-2003 04:33 AM
batik and fop on weblogic 5.1 Benny XML 0 07-10-2003 02:16 PM