Jeremias Maerki-2 wrote: > > 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. > > > Jeremias Maerki > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > >
Thanks Jeremias for helping me debug this problem. Using fill-opacity solves both my problems and the pdf turned out great!! -- View this message in context: http://www.nabble.com/PDFTranscoder-Text-Opacity---Transcoding-Hints-tp22874236p23023831.html Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
