BridgeContext ctx = new BridgeContext(userAgent);
SVGOMDocument svgDoc = (SVGOMDocument) document;
// build the GVT tree
GraphicsNode gvtRoot = buildGVT(ctx, svgDoc);
// get the 'width' and 'height' attributes of the SVG document
width = (int) (ctx.getDocumentSize().getWidth() + 0.5);
height = (int) (ctx.getDocumentSize().getHeight() + 0.5);
SpriteGraphics2D swf2d = new SpriteGraphics2D(width, height);
gvtRoot.paint(swf2d);
tags = swf2d.getTags();
//Override width and height based on the SWF-specific bounds of the sprite contents
//However we have to correct co-ordinates back to pixels... TODO: Remove all TWIPS references!
Rect bounds = swf2d.getBounds();