3
votes

Hi I was working with apache fop and when the number of pages exceeds about 130 pages ,it could not generate the pdf .... Is there any limit to page number or the length of xml file...

Exception in thread "main" java.lang.OutOfMemoryError: Java heap

space at java.io.BufferedReader.(BufferedReader.java:80) at java.io.BufferedReader.(BufferedReader.java:91) at org.apache.xml.dtm.ObjectFactory.findJarServiceProviderName(ObjectFac tory.java:579) at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClassName(ObjectFactory .java:373) at org.apache.xml.dtm.ObjectFactory.lookUpFactoryClass(ObjectFactory.jav a:206) at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:131)

        at org.apache.xml.dtm.ObjectFactory.createObject(ObjectFactory.java:101)

        at org.apache.xml.dtm.DTMManager.newInstance(DTMManager.java:135)
        at org.apache.xpath.XPathContext.reset(XPathContext.java:350)
        at org.apache.xalan.transformer.TransformerImpl.reset(TransformerImpl.ja
va:505)
        at org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme
rImpl.java:1436)
        at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:709)
        at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1284)
        at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1262)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:214)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)
1
I don't believe there is a hard limit on page count or XML file size. It is likely that there was some sort of exception (Out Of Memory). It would be helpful if you could share logs and/or exceptions that may have been produced and tell us how you are invoking the process.Mads Hansen
I have added the log herewithThunder
I've generated PDF reports using FOP that exceed 400 pages without any problems in a web application setting and in a console (junit) setting.tmeisenh
may be its due to my long xml its around 900 linesThunder

1 Answers

3
votes

I've created reports that are made from xmls that were several hundred thousand lines long. However I have had some issues creating smaller reports filled with svgs.

Your issue is probably that java by default only allocates 32 MB memory (if I recall correctly) so it's running out of memory.

In the fop.bat file (assumimg you're running on windows) add the following setting

rem Increase standard Java VM heap size, so that bigger reports get enough memory set JAVAOPTS=-Xmx512M

and alter the execution line as follows

"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%

This should work with 0.95 at least