Hi,

I'm prototyping a small application that builds an SVG DOM in memory and
writes it to disk as a PNG, using the PNGTranscoder, and also as an SVG
file.

I'm trying to use the text flow functionality in Batik, but I'm not sure if
I'm using it properly. My rough code is:

        String s = "Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Sed mollis mollis "
                + "mi ut ultricies. Nullam magna ipsum, porta vel dui
convallis, rutrum "
                + "imperdiet eros. Aliquam erat volutpat.";

        impl = new SVG12DOMImplementation();

        Element rect = document.createElementNS(null, "rect");
        rect.setAttributeNS(null, "x", "10");
        rect.setAttributeNS(null, "y","10");
        rect.setAttributeNS(null, "width", "400");
        rect.setAttributeNS(null, "height", "400");

        Element fr = document.createElementNS(null, "flowRegion");
        fr.appendChild(rect);

        Element fp = document.createElementNS( null , "flowPara");
        fp.setTextContent(s);

        Element ft = document.createElementNS( null , "flowRoot");
        ft.appendChild(fr);
        ft.appendChild(fp);

        getRootElement().appendChild(el);

The exported SVG file does contain these elements, but the PNG is blank.

Do I need to specify a namespace in the call to createElementNS?

The DOM contains:

<flowRoot xmlns="http://www.w3.org/2000/svg";><flowRegion
style="font-size:16px;font-family:Times;fill:none;stroke:#red;"><rect
x="10" width="290" height="390" y="10"/></flowRegion><flowPara>Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Sed mollis mollis mi ut
ultricies. Nullam magna ipsum, porta vel dui convallis, rutrum imperdiet
eros. Aliquam erat volutpat.</flowPara></flowRoot>

Am I on the right track? Does the PNGTranscoder support rendering extension
elements, like flowRoot?

Thanks
Mike

Reply via email to