xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Stuart <nicholas.stu...@gmail.com>
Subject JFreeChart, FOP, and Batik
Date Fri, 01 Apr 2005 18:02:21 GMT
Hello all, I'm new Batik and have tried to find the answer to my
problem but cant seem to get it.

 I'm creating an SVG file through JFreeChart using Batik. It gets
created fine if I dont try and touch it. The problem is that in order
for FOP to use the image it needs to have a width and height in the
<svg> root.

If I add the attributes in there manually it works fine (say to like,
width="14cm" height="10cm"). The image loads up in FOP and everything
is good to go. BUT when I try to do this through code:
        //this is after the image is generated from JFree chart.
       Element root = svgGenerator.getRoot();
        root.setAttributeNS(null, "width", "14cm");
        root.setAttributeNS(null, "height", "14cm");

All I end up with after using svgGenerator.stream() is an empty image
document, AND the attributes still arent even seet.

Here's how the image is written out:
Writer out = new OutputStreamWriter(
        new FileOutputStream(file), "UTF-8");
        svgGenerator.stream(out, useCSS);

And here is what I get for output if I try to add the attributes above.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1;
color-rendering:auto; color-interpolation:auto; text-rendering:auto;
stroke:black; stroke-linecap:square; stroke-miterlimit:10;
shape-rendering:auto; stroke-opacity:1; fill:black;
stroke-dasharray:none; font-weight:normal; stroke-width:1;
font-family:&apos;Dialog&apos;; font-style:normal;
stroke-linejoin:miter; font-size:12; stroke-dashoffset:0;
image-rendering:auto;" xmlns="http://www.w3.org/2000/svg">
  <!--Generated by the Batik Graphics2D SVG Generator-->
  <defs id="genericDefs" />
  <g />

Any ideas? Thanks for your help!

To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message