Hi Leonardo, "Leonardo Kenji Shikida" <[EMAIL PROTECTED]> wrote on 09/21/2007 11:33:53 AM:
> I am trying to generate tiled Jpegs from my SVG but it's generating > blank images > > My assumption is that > > Document doc = domImpl.createDocument(svgNS, "svg", null); > SVGGraphics2D svg = new SVGGraphics2D(doc); > > actually means that, when the app draws something in the graphical > context (svg), actually, nodes are being added to the SVG DOM > representation (doc) This assumption is incorrect. When you draw stuff it's added to internal structures in the SVGGraphics2D. It only uses the given document as a factory to construct DOM elements. If you want your drawing as part of the document 'doc' you need to call 'getRoot(doc. getDocumentElement())'. This will append the contents of the SVGGraphics2D as children of your document's root element. This also 'clears' the state of the SVGGraphics2D. > by the way, just another questions > > - Is there a way to save my SVG as a PDF document? You can use your drawing code that generates the SVG to generate PDF with the PDFGraphics2D class from FOP (also bundled with Batik in the pdf-transcoder). You could also use the SVG to PDF transcoder on your SVG but that will have two 'translations' as opposed to just one. > - My SVG can become quite large, so I am afraid a in-memory DOM will > give me a OutOfMemory exception. Is there any workaroud? Like some > sort of file-based structure that can bypass the JVM 32-bit limitation > of addressing about up to (almost) 2 GB in the heap? What's the usual > approach for this? Well with the SVGGraphics2D you could periodically call getRoot and stream the results out to a file. The generated SVG would be ugly but should work. Also I noticed that you are calling paintComponent which I assume means that you are drawing Swing Components in which case you need to make sure that you aren't just capturing the swing offscreen bitmap. Batik includes batik.svggen.SwingPrettyPrint which you can use to avoid the problem or as sample code. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
