xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkat S Kota <vsrk...@netscape.net>
Subject problem with JPEGTranscoder
Date Tue, 15 Jun 2004 00:13:34 GMT

I am have a webapp which is trying to generate JPEG file from SVG DOM. 
The SVG DOM itself is generated using XSL Translations from an XML data 
representation. When I simply save the SVG DOM to a file using 
FileStream and open the SVG file, I am getting the desired result. 
However, The JPEG transformation of the same SVG DOM using 
JPEGTranscoder::transcode()  fails (nothing is generated)

Some of the previous postings on this alias indicate that the DOM from 
the XSL transformer is not suitable for JPEGTranscoder. So, I am 
converting the DOM using the SVGDOMImplementation as follows:

         // svgDocument is the document generated using 
         //  prior to the code block shown below
        SVGDOMImplementation impl = 
        Document batikDoc = 

        // convert the SVG DOM into Jpeg format
        FileOutputStream oStream = null;
        try {
            JPEGTranscoder transcoder = new JPEGTranscoder();
new Float(0.8));
            TranscoderInput input = new TranscoderInput(batikDoc);
            oStream = new FileOutputStream(jpgFileName);
            TranscoderOutput output = new TranscoderOutput(oStream);

The transcode() method invocation always results in throwing Exception 
that some of the mandatory attributes are required ( Eg: The attribute 
"r" of the element <circle> is required ). By printing the DOMs, It 
appears that the attribute values in the original DOM are not copied in 
the deepCloneDocument() method. All elements and the corresponding 
attributes in the original document are present but the attributes do 
not have any values.

Can someone please guide me how to workaround this problem? Also, Please 
let me know if there is an entirely different way to do what I am trying to?


View raw message