Hi, just to let everyone know. I am now using a much shorter solution posted by someone else on this forum. It is synchronous, caters for different input sources (URL, Reader, InputStream, ect.) and gets the viewBox right. Is this the way it should be done?
public static org.apache.batik.gvt.GraphicsNode getSvgIcon(java.net.URL url) { org.apache.batik.gvt.GraphicsNode svgIcon = null; try { String xmlParser = org.apache.batik.util.XMLResourceDescriptor.getXMLParserClassName(); org.apache.batik.dom.svg.SAXSVGDocumentFactory df = new org.apache.batik.dom.svg.SAXSVGDocumentFactory( xmlParser); org.w3c.dom.svg.SVGDocument doc = df.createSVGDocument(url.toString()); org.apache.batik.bridge.UserAgent userAgent = new org.apache.batik.bridge.UserAgentAdapter(); org.apache.batik.bridge.DocumentLoader loader = new org.apache.batik.bridge.DocumentLoader(userAgent); org.apache.batik.bridge.BridgeContext ctx = new org.apache.batik.bridge.BridgeContext(userAgent, loader); ctx.setDynamicState(org.apache.batik.bridge.BridgeContext.DYNAMIC); org.apache.batik.bridge.GVTBuilder builder = new org.apache.batik.bridge.GVTBuilder(); svgIcon = builder.build(ctx, doc); } catch (Exception excp) { svgIcon = null; excp.printStackTrace(); } return svgIcon; } Thanks, Alex -- View this message in context: http://batik.2283329.n4.nabble.com/General-difficulties-and-problems-getting-the-size-right-in-painting-an-SVG-document-containing-a-vi-tp4100365p4104302.html Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org