You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by ma...@iworks.fr on 2003/10/08 10:27:46 UTC

OutOfMemoryError while rendering huge SVG

Hello experts,

I try to transform a xls-fo stream into a pdf file (using FOP 0.20.5, the 
Driver class and PDF Renderer).
My xsl-fo embeds huge svg graphics. 
I use multiple page sequences, each page contains only one svg tag.
When the embedded svg is too large, I get a OutOfMemoryError while 
rendering the current page.

I read the faqs and increased the JVM memory : that's OK for me, but the 
end-user system won't have enough memory !

What should I do :
- should I use smaller embedded svg graphics in each page, rather than one 
? I don't know if it would help, because all graphics would remain in the 
same page sequence.
- should I use many external svg graphics ? (FOP would cache these 
graphics).

Thanks for your advices.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: OutOfMemoryError while rendering huge SVG

Posted by "J.Pietschmann" <j3...@yahoo.de>.
mathieu.fretiere@iworks.fr wrote:
> When the embedded svg is too large, I get a OutOfMemoryError while 
> rendering the current page.

It would be interesting to have details on what is considered
a "too large" SVG, and what parts are responsible for the overflow.
There are basically three possiblities:
- The SVG source creates a styled DOM so large that memory is already
  scarce before rendering is even attempted.
- Intermediate data structures become too large during rendering
- The rendered result swallows up a lot of memory.

I'd consider rendering the SVG outside of FOP into a bitmap image and
include the bitmap into the PDF.
In the first case, there might also be some room for reducing the SVG
source by reusing path definitions and possibly other stuff by using
references and clever transformations.
Another possibility is to set strokeSVGText to false
  http://xml.apache.org/fop/graphics.html#svg-pdf-text
which has potential to dramatically reduce the amount of memory
needed for the result, especially if the SVG contains lots of text.
> 
> What should I do :
> - should I use smaller embedded svg graphics in each page, rather than one 
> ? I don't know if it would help, because all graphics would remain in the 
> same page sequence.

It depends. Just try it.

> - should I use many external svg graphics ? (FOP would cache these 
> graphics).

I doubt this would work much better than embedding the SVG, but
you can try it too.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: OutOfMemoryError while rendering huge SVG

Posted by Clay Leeds <cl...@medata.com>.
mathieu.fretiere@iworks.fr wrote:
> I read the faqs and increased the JVM memory : that's OK for me, but the 
> end-user system won't have enough memory !
> 
> What should I do :

FOP uses Batik for handling SVG, so a good place to start would be:

   http://xml.apache.org/batik/

You might check out their FAQ or ask on their mailing list.

Good luck! Please report back any solutions so others may benefit.

Web Maestro Clay


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org