|
Hi, 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, /9j/4AAQSkZJRgABAQAAAQABAAD//gAuSW50ZWwoUikgSlBFRyBMaWJyYXJ5LCB2 ... 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 at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source) at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source) at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source) at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source) at edu.rutgers.elearning.util.SVGRasterizer.rasterizeSVG(SVGRasterizer.java:178)** ... 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 SAXSVGDocumentFactory(parser); 3 SVGDocument doc = (SVGDocument) svgFactory.createDocument(url); 4 TranscoderInput input = new TranscoderInput(doc); 5 BufferedImageTranscoder transcoder = new BufferedImageTranscoder(); 6 BufferedImage img = null; try{ 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. Martin |
- Re: JSVGCanvas background thomas . deweese
- RE: JSVGCanvas background Bishop, Michael W. CONTR J9C880
- RE: JSVGCanvas background V. de Weger
- RE: JSVGCanvas background thomas . deweese
- RE: JSVGCanvas background Bishop, Michael W. CONTR J9C880
- RE: JSVGCanvas background Tonny Kohar
- Identifying SVG DOM node ... Erik Bunn
- Re: Identifying SVG DOM n... thomas . deweese
- Re: Identifying SVG DOM n... Erik Bunn
- Solved - Re: Identifying ... Erik Bunn
- org.apache.batik.transcod... Martin Constantine
- Re: org.apache.batik.tran... Archie Cobbs
- Re: org.apache.batik.tran... thomas . deweese
- Re: org.apache.batik.tran... Martin Constantine
- Modifying CSS via SVGStyl... Erik Bunn
- Re: Modifying CSS via SVG... thomas . deweese
- Re: Modifying CSS via SVG... Erik Bunn
- RE: JSVGCanvas background Bishop, Michael W. CONTR J9C880
- RE: JSVGCanvas background thomas . deweese
- Re: JSVGCanvas background V. de Weger
- Re: JSVGCanvas background thomas . deweese
