I normally work with xsl-fo for transform xml files into pdf.
Usually I do it with small xml files.
Now I want to do it using a large XML file (5000 records)
I got the following error message
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

I read on apache’s site that:
To avoid errors like this, you need to pass an extra parameter to the java
command used in the fop script. This can be accomplished by creating a
~/.foprc (which is sourced by the fop script) and adding the parameter to the
FOP_OPTS environment variable.

The fop script looks for a FOP_HOME environment variable to locate the FOP
class libraries. You can create this variable using the ~/.foprc file as well.
Create a ~/.foprc file using the following commands:

cat > ~/.foprc << "EOF"


Replace <RAM_Installed> with a number representing the amount of RAM installed
in your computer (in megabytes). An example would be FOP_OPTS="-Xmx768m". For
more information about memory issues running FOP, see

To include the fop  script in your path, update your personal or system-wide
profile with the following:

However it takes very long time to process the information (about 2 hrs)
There is another way to solve this issue?
Any other recommendation, for example using another similar tool?

Thank you for your comments,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
You don't exactly say how big the files are we are talking about.
5000 records, how many megabytes are we talking about?
You could try to bump up the heap space even more.
I have FOP processes running requiring 2GB of memory

If you don't have too much memory on your machine and there is a lot of paging going on, slowness is the penalty

FOP is very greedy memory wise
If you have all in one page flow FOP builds a huge memory tree and will be repaging a lot based on decissions made on pages very late in the process.
Introducing pagebreaks (by breaking up pageflows) helps a lot

But the 2GB process I just mention, requires less than 200M using Antenna House... and that flies, really

If you are not using fop specific extensions,
I recommend that you do some tests with
or any of the other commercial FO processors

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Printers and Scanners

From novice to tech pro — start learning today.