SVGDocument doc = new SVGDocumentImpl();
svg.setSVGDocument(doc);
svg.start();
/* add the SVG area to the containing area */
ForeignObjectArea foa = (ForeignObjectArea) area;
foa.setObject(svg);
foa.setIntrinsicWidth(svg.getWidth());
foa.setIntrinsicHeight(svg.getHeight());
doc.appendChild((SVGSVGElement) createGraphic());
/* finish off the SVG area */
svg.end();