Thanks for the test case. I learned something about SVG debugging it. Hopefully, this will help you, too. So your SVG is using opacity="0.3" on some <g> elements. The SVG 1.1 spec says in http://www.w3.org/TR/SVG11/masking.html#ObjectAndGroupOpacityProperties:
"Except for object/group opacity (described just below), all other opacity properties are involved in intermediate rendering operations. Object/group opacity can be thought of conceptually as a postprocessing operation. Conceptually, after the object/group is rendered into an RGBA offscreen image, the object/group opacity setting specifies how to blend the offscreen image into the current background." And that's exactly what happens here: Batik creates an offscreen bitmap image from the group where opacity="0.3" is specified. That happens, for example, with all the room names (id="Text Architectural Number and Name"). Now, if you render just a portion of the SVG but scale it up to a relatively big paper size, these opacity groups get large, too. At some point there's just not enough memory to allocate the bitmaps in memory at which point you get an OutOfMemoryError. Example: Paper size: 5in * 5in at 72dpi = 72*5 * 72*5 pixels = 130 Kpixels Paper size: 10in * 10in at 72dpi = 72*10 * 72*10 pixels = 518 Kpixels Paper size: 5in * 5in at 200dpi = 200*5 * 200*5 pixels = 1 Mpixels Then: each pixel in RGBA takes 32 bits, so you need to multiply the number of pixels by 4 to get the number of bytes required. You see, the bitmap size grows quadratically if you either increase the physical document size or the device/target resolution. That can quickly let your JVM explode. The easiest way is to give the JVM more memory (ex. -Xmx2048M). If you've already done that, you can: - decrease the device resolution - decrease the paper size (KEY_WIDTH/KEY_HEIGHT) - try to make the opacity groups smaller, i.e. apply the opacity property one level deeper than the super-group. That way Batik would create a smaller bitmap for each under-group instead of one big one. This should break down the maximum bitmap size necessary for the opacity groups. - Try to use fill-opacity instead of opacity in which case no offscreen images are used and Batik gives the PDFTranscoder the opacity value so the elements can be filled using PDF opacity instead of a transparent bitmap. On 09.04.2009 23:08:54 vyang wrote: > > > Jeremias Maerki-2 wrote: > > > > Can you post an SVG files that demonstrates the fuzzyness? As for the > > OutOfMemoryError, I would assume that you might be giving very large > > values with the hints that blow the JVM limit. Try lowering these values > > to see if the exception goes away. Without a way to reproduce this I'm > > not sure how I can help. > > > > Jeremias Maerki > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > > > Here is the SVG File: http://www.nabble.com/file/p22979253/Test.svg > Test.svg > You'll also need the css file: > http://www.nabble.com/file/p22979253/Attributes.css Attributes.css > > As for the out of memory error, I did try giving it smaller width and length > values and still get the same error. I've also used similar coding for my > printing and that works without any memory error. As I noted earlier if I > remove the transcodinghints that sets the aoi, width, and length than the > pdf prints fine. But removing it causes it to print the whole svg file. I > assume that if you don't set your own aoi, width and length then the > transcoder sets its own aoi, width and length using the current canvas > values. Which that shouldn't be any difference than me setting my own aoi, > which is smaller. > > Any more thoughts on what could be causing this would be much appreciated. > > vyang > -- > View this message in context: > http://www.nabble.com/PDFTranscoder-Text-Opacity---Transcoding-Hints-tp22874236p22979253.html > Sent from the Batik - Users mailing list archive at Nabble.com. > > Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
