Hi thomas,
Thanks for your comments.
I've modified the code as per your said,
Element root = svgGenerator.getRoot();
root.setAttributeNS(null, "viewBox", "0 0 800 600");
svgGenerator.setSVGCanvasSize(new Dimension(500,500));
label.print(svgGenerator);
Writer out = new OutputStreamWriter(System.out, "UTF-8");
PrintWriter savefile = new PrintWriter(new FileWriter(fil));
svgGenerator.stream(root, savefile, true, false);
I got the outout like this,but im missing my HTML graphics content in SVG
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg style="fill-opacity:1; color-rendering:auto; color-interpolation:auto;
stroke:black; text-rendering:auto; stroke-linecap:square;
stroke-miterlimit:10; stroke-opacity:1; shape-rendering:auto; fill:black;
stroke-dasharray:none; font-weight:normal; stroke-width:1;
font-family:'Dialog'; font-style:normal; stroke-linejoin:miter;
font-size:12; stroke-dashoffset:0; image-rendering:auto;"
xmlns="http://www.w3.org/2000/svg" width="500" viewBox="0 0 800 600"
xmlns:xlink="http://www.w3.org/1999/xlink" height="500"
><!--Generated by the Batik Graphics2D SVG Generator--><defs
id="genericDefs"
/><g
/></svg
>
And when i replace the below statement
svgGenerator.stream(root, savefile, true, false);
with
svgGenerator.stream(savefile, true);
I got my HTML graphics content in SVG,but viewbox attribute is not appeared
in SVG
Any suggestions.
Regards
Aashik.
--
View this message in context:
http://www.nabble.com/How-to-set-viewbox-attribute-in-SVGGraphics2D-tp24600865p24604342.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]