Hello again:

 

I am loading an existing SVG file into a Document and adding some nodes
to it.

 

When I take the resulting Document and transcode it to JPEG or PNG, the
additions (a new <path>) I made do not show up in the image.  I printed
the dom to inspect it and my additions were present and formatted
correctly.

 

            //Load dom

String parser = XMLResourceDescriptor.getXMLParserClassName();

        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);

        String uri = new File(getServletContext().getRealPath("/") +
"svg\\polarity.svg").toURL().toString();

        SVGDocument doc = (SVGDocument) f.createDocument(uri);  

 

            . . .

 

            //perform addition of new <path> . . .

            

. . .

 

        DOMUtil.printDOM(doc);   //Print dom to console - everything is
fine

       

        response.setContentType("image/png");

        ServletOutputStream out = response.getOutputStream();

        PNGTranscoder t = new PNGTranscoder();

        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8));

        t.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new
Float(1000));

        t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new Float(1000));

        TranscoderInput input = new TranscoderInput(doc);

        

        TranscoderOutput output = new TranscoderOutput(out);

        try {

            t.transcode(input, output);

        }

        catch (TranscoderException e) {

            e.printStackTrace();

        }

 

        out.flush();

        out.close();

 

 

The added node prints as:

 

&lt;path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:10px;stro
ke-linecap:butt;strike-linejoin:miter;stroke-opacity:1" d="M -120,-300 C
-200,-300 -200,0 -200,0" id="curveA">

 

08/03/06 11:54:18 </path>

Other paths have the &lt; and are not affected.   Any suggestions?

 

 

 

Regards,

Eric Hamacher

 

******************************

THIS EMAIL IS INTENDED ONLY FOR THE REVIEW OF THE ADDRESSEE(S), AND MAY
CONTAIN CONFIDENTIAL AND LEGALLY PRIVILEGED INFORMATION. INTERCEPTION,
COPYING, DISSEMINATION, OR OTHER USE BY OTHER THAN THE ADDRESSEE(S) IS
PROHIBITED AND MAY BE PENALIZED UNDER APPLICABLE PRIVACY LAWS. IF YOU
RECEIVED THIS EMAIL IN ERROR, PLEASE DELETE IT AND NOTIFY ME BY RETURN
EMAIL TO [EMAIL PROTECTED] *******************************

 

Reply via email to