xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergei Rodionov" <sergei.rodio...@axibase.com>
Subject rasterizer problem
Date Thu, 01 Jun 2006 14:55:02 GMT
In my server application I need to load an svg document on user request, parse it, modify
DOM and CSS styles and rasterize the svg document as jpeg.
It seems that I need to build a bridge context to enable dynamic DOM and CSS support.
It all works fine, but sometimes the code throws an NPE typical for cases when there is no
bridge context .
I looked at the GVTBuilder source  ($Id: GVTBuilder.java,v 1.30 2005/03/27 08:58:30 cam Exp
$) , found these lines.
        // <!> FIXME: TO BE REMOVED
        if (ctx.isDynamic()) {
            // register DOM listeners for dynamic support
My environment JRE 1.4.2, Windows, batik 1.6
Thanks for any pointers!
  String svgURI = new File(path).toURL().toString();
  SVGDOMImplementation domImpl = new SVGDOMImplementation();
  SAXDocumentFactory f = new SAXDocumentFactory(domImpl,
  GZIPInputStream zIn = new GZIPInputStream(new FileInputStream(path));
  Document res = f.createDocument("http://www.w3.org/2000/svg", "svg", svgURI, zIn);
    UserAgent userAgent = new  MyUserAgent();
   DocumentLoader loader = new DocumentLoader(userAgent);
   BridgeContext ctx = new BridgeContext(userAgent, loader);
   GVTBuilder builder = new GVTBuilder();
   GraphicsNode gvtRoot = builder.build(ctx, res);

View raw message