Hi all,
I'm currently looking into jasperreports.sf.net to use SVG as intermediate graphics format when including images. Especially with rendered charts, a vector format is highly desirable.
Creating SVG documents for the charts is easy because of the great SVGGraphics2D provided by batik. This pretty much covers the graphics import.
However, for creating eg. PDF using itext, the report is drawn on a Graphics2D object provided by itext. Hence included images would need to be painted on the same Graphics2D object, actually on a given rectangle of the Graphics2D object.
I'm quite stuck at this point because I haven't successfully found a way to draw an SVG on a Graphics2D :-( I believe it should work along the lines of
// create initial svg document for graphical object // included in report DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation(); String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; SVGDocument svgDocument = (SVGDocument)domImpl.createDocument(svgNS, "svg", null); SVGGraphics2D svgG2D = new SVGGraphics2D(svgDocument);
... // draw on the svgG2D ...
// populate document Element root = svgDocument.getDocumentElement(); svgG2D.getRoot(root);
... // store document somewhere // up to this point it looks OK because writing the XML // to a file and loading it with squiggle looks good ...
// now, render included svg to provided Graphics2D // at given area ((x0,y0),(x1,y1)) JSVGComponent svgComp = new JSVGComponent(); svgComp.setDocument(svgDocument); svgComp.paint(g2d);
But it looks like I'm missing something here because I haven't been able to draw something this way :-( Besides: how to specify the placing of the output?
TIA Chris.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]