You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Jeroen de Zwart <fa...@dds.nl> on 2001/02/19 10:39:54 UTC

How to use viewBox property for SVG

Thanks to Aaron for writing this very usefull code for providing the viewBox
attribute,

But with me it's not working. The code in PDFRenderer.java:

590    SVGSVGElement svg = area.getSVGDocument().getRootElement();
591    int w = (int)(svg.getWidth().getBaseVal().getValue() * 1000);
592    int h = (int)(svg.getHeight().getBaseVal().getValue() * 1000);

finds values for w and h but

597    if (svg.getViewBox () != null) {

is always null so nothing happens! please tell me what is wrong.

this is the fo i use with the latest (16feb) FOP 0.17 DEV:

<svg:svg width="100mm" height="50mm" viewBox="0 0 1500 1000">
<svg:rect x="0" y="0" width="1500" height="1000" style="fill:yellow" />
<svg:path style="fill:red" d="M 750,100 L 250,900 L 1250,900 z"/>
</svg:svg>