xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Eisenberg <da...@catcode.com>
Subject More info on XSL to SVG problem
Date Fri, 17 Aug 2001 18:41:48 GMT
I am attempting to read an XML file, use Xalan to convert it to
SVG, and then use Batik's transcoder to create a JPG file to send
to a user (all this from a servlet).  I have done further research,
and have narrowed down the problem:

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

        // create the transcoder input
        TranscoderInput input = new TranscoderInput( svgDoc );
        TranscoderOutput output =
             new TranscoderOutput(response.getWriter());
         t.transcode(input, output); /* error occurs here */
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }

===================================
The serialized SVG document is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg contentScriptType="text/ecmascript" width="350" zoomAndPan="magnify"
contentStyleType="text/css" height=" 200" preserveAspectRatio="xMidYMid meet"
xmlns="http://www.w3.org/2000/svg"><svg width="350" height="200" viewBox="0 0 350 200">
<defs><path fill="none" id="wind-arrow" d="M 40 40 h 25"
stroke="black"/></defs><g><rect x="
10" y="10" fill="blue" width="30" height="20" stroke="none"/></g><g><circle
fill="red" r="20" y="50" cx="50" s
troke="none"/></g></svg></svg>
==================================
The error appears to be in this statement in
org/apache/batik/transcoder/image/ImageTranscoder.java:

    BufferedImage rend = renderer.getOffScreen();

which gives back a result of "null."  I've tried running the program as a
pure application rather than in a servlet context, and I get the same
error:

java.lang.NullPointerException
        at sun.java2d.SunGraphics2D.drawRenderedImage(SunGraphics2D.java:1849)
        at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:261)
        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:126)
        at Transform.emitJPG(Transform.java:338)
        at Transform.doPost(Transform.java:160)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
        at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
        at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:2
13)
        at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at java.lang.Thread.run(Thread.java:484)
		
-- 
J. David Eisenberg
http://catcode.com




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message