xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Constantine <mac...@lecture123.com>
Subject org.apache.batik.transcoder.TranscoderException: null
Date Tue, 26 Sep 2006 07:48:56 GMT

The following is the end-result of a problem I'm having with Batik 
(getting to the root of this takes a fair amount of explanation so 
please bare with me if the post seems lacking):

Caused by: org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
The URI "data:image/jpg;base64, 

... lots more lines of image bits...

bbr/AJ+Zv+/h oAPtt1/z8zf9/DQAfbbr/n5m/wC/hoAiuL26+yzf6TN9xv8AlofSgAD/2Q=="
on element <image> can't be opened because:
URL data in unsupported format or corrupt
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
    ... 3 more

**I broke down the code in SVGRasterizer.java in the listing below. The 
exception actually occurs at line 11 below.

Some context:

OS = Windows XP Sp2
JRE/JDK = 1.5.0_08
Batik version = 1.5.1

Here is the sequence of calls that yield the exception:

1            String parser = XMLResourceDescriptor.getXMLParserClassName();
2            SAXSVGDocumentFactory svgFactory = new 
3            SVGDocument doc = (SVGDocument) svgFactory.createDocument(url);

4            TranscoderInput input = new TranscoderInput(doc);
5            BufferedImageTranscoder transcoder = new 
6            BufferedImage img = null;
7                 SVGRasterizer rasterizer = new SVGRasterizer();
8                 transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, 
                      new Float(size.getWidth()));

9                 transcoder.addTranscodingHint(ImageTranscoder.KEY_HEIGHT,
                      new Float(size.getHeight()));

10                TranscoderInput input = new TranscoderInput(doc);   
11                transcoder.transcode(input, null);
12                img = transcoder.getBufferedImage();
              }catch(Exception ioe){
13                ioe.printStackTrace();

Prior to this code running, a single-slide PowerPoint is converted 
successfully to an svg document, which loads in both IE and FireFox 
without any problem. This document is loaded into the "doc" variable 
above at line 3. The program barfs out the exception at line 11.

What's very strange is that this code sequence /always/ works when I run 
from my IDE (netbeans) and always barfs when I run from the command line 
(via a bat file). If anyone can shed some light on this behaviour, I 
would greatly appreciate it. Please also don't hesitate to request 
further info. Thanks in advance.


View raw message