The problem with setting the canvas size is that I need to set it in
centimeters in order for FOP to use it correctly, but Dimension is
only pixels which makes sense for most images and the like.

I got around it by doing to following (which is ugly, but it works).

DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();
        //Hack below in order to add the width/height to the svg file.
        //Width and height are needed by FOP in order to render correctly.
        try {
            DocumentBuilder builder =
                    factory.newDocumentBuilder();
            document = builder.parse(file);
            log.error("Element: " +
document.getDocumentElement().getNodeName());
            
            document.getDocumentElement().setAttributeNS(null, "width", "14cm");
            document.getDocumentElement().setAttributeNS(null,
"height", "9.5cm");
            TransformerFactory tFactory =
                    TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();
            
            DOMSource source = new DOMSource(document);
            file.delete();
            file.createNewFile();
            out = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
            StreamResult result = new StreamResult(out);
            transformer.transform(source, result);
        } catch (Exception spe) {
            log.error("Error parsing document.", spe);
        }

I can change the canvas side with out any problems, but thats not the
issue. I'm guessing what I want/need to do is not a part of SVG (not
sure) so it isn't really supported.

Thanks for the help and suggestions.
-Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to