xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maik Schürer <m...@schuerer.name>
Subject Re: Scaling SVG Documents
Date Mon, 13 Nov 2006 16:14:11 GMT
Hi Andre,
 > svgElement.setAttributeNS(null, "viewBox", "0px 0px width height");
I think, the words 'width' and 'height' are wrong for "viewBox" there.
You have to write the numeric values for width and height of the section 
(viewBox) you want to see.
Best regards
Maik


André Rüdiger schrieb:
> Hello again list!
> 
> There's one more problem i'd like to solve. I'm trying to load an existing
> SVG Document and scale it down so that it doesn't exceed a certain
> width/height. (The result will later be transformed to xsl-fo.)
> 
> Here's what I'm currently trying to achieve this:
> 
>     InputStream inputStream = [...];
>     SAXSVGDocumentFactory f =
>         new SAXSVGDocumentFactory(
>             XMLResourceDescriptor.getXMLParserClassName());
>     Document svgDoc = f.createDocument(symbolURL, inputStream);
> 
>     // Now trying to scale the SVG Document (doesn't work)
>     String width = "50px";
>     String height = "50px";
>     
>     Element svgElement = svgDoc.getDocumentElement();
>     
>     svgElement.setAttributeNS(null, "viewBox", "0px 0px width height");
>     svgElement.setAttributeNS(null, "width", width);
>     svgElement.setAttributeNS(null, "height", height);
> 
> That doesn't work. Only the upper left corner of the SVG is displayed.
> 
> Do you have a solution to my scaling problem? (Perhaps Batik provides some
> functionality to manipulate the DOM directly?) Or do I simply have to set
> some other attributes?
> 
> Some example code would be highly appreciated. ;)
> 
> Thanks again for your time,
> André
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 

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


Mime
View raw message