Re: OutOfMemoryError: Java heap space
Hello, This is an old thread but this problem is more newsworthy than ever. I'm running FOP 1.1 (trunk didn't help either), my XSL-FO is only 500 KB large, and /*only text!*/, I allocated 7(!)GB to my JVM on a 64 bits Windows 7 and despite all that, FOP, after reeling in a long time, throws a java.lang.OutOfMemoryError: Java heap space exception when generating a PDF. Oh, and I just can't split my XSL-FO into several page-sequences, it's a one-block text that doesn't allow page breaks. There aren't any page references either. So that's it. No workaround works and I'm stuck being unable to generate a all-text PDF from a 500 KB XSL-FO with 7GB allocated memory. Here is the stack, for what it's worth: at org.apache.fop.layoutmgr.BreakingAlgorithm.createNode(BreakingAlgorithm.java:712) at org.apache.fop.layoutmgr.BreakingAlgorithm.addBreaks(BreakingAlgorithm.java:1151) at org.apache.fop.layoutmgr.BreakingAlgorithm.considerLegalBreak(BreakingAlgorithm.java:965) at org.apache.fop.layoutmgr.BreakingAlgorithm.handlePenaltyAt(BreakingAlgorithm.java:818) at org.apache.fop.layoutmgr.BreakingAlgorithm.handleElementAt(BreakingAlgorithm.java:754) at org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints(BreakingAlgorithm.java:553) at org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints(BreakingAlgorithm.java:503) at org.apache.fop.layoutmgr.inline.LineLayoutManager.findOptimalBreakingPoints(LineLayoutManager.java:895) at org.apache.fop.layoutmgr.inline.LineLayoutManager.createLineBreaks(LineLayoutManager.java:815) at org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:635) at org.apache.fop.layoutmgr.BlockLayoutManager.getNextChildElements(BlockLayoutManager.java:141) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:288) at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:113) at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:105) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:497) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:288) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:238) at org.apache.fop.layoutmgr.list.ListItemLayoutManager.getNextKnuthElements(ListItemLayoutManager.java:221) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:497) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:288) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:238) at org.apache.fop.layoutmgr.list.ListBlockLayoutManager.getNextKnuthElements(ListBlockLayoutManager.java:105) at org.apache.fop.layoutmgr.BlockLayoutManager.getNextChildElements(BlockLayoutManager.java:141) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:288) at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:113) at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:105) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:497) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:288) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:238) at org.apache.fop.layoutmgr.list.ListItemLayoutManager.getNextKnuthElements(ListItemLayoutManager.java:221) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextChildElements(BlockStackingLayoutManager.java:497) at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:288) Any help would be highly appreciated. Cheers, Erwann -- View this message in context: http://apache-fop.1065347.n5.nabble.com/OutOfMemoryError-Java-heap-space-tp4271p40861.html Sent from the FOP - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
Re: reduce size of PDF generated with FOP
I'm sorry that I don't follow this post up on a more regular basis but I've been pretty busy with other stuff here at work. Fonts are indeed embedded more than once in merged PDFs. I'm going to look into it, maybe try and merge them a different way. As for the individual PDFs, I managed to reduce their size by a considerable amount by dividing the resolution of images by a factor of 2: 150 dpi instead of 300 dpi do the trick. The files are still bigger than the ones generated by FrameMaker (76 KB) but 160 KB is still better than 380 KB. Such a resolution is not satisfactory for printing but is good enough for an on-screen viewing. I should be able to provide you with sample PDFs at the end of the week. -- View this message in context: http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619p38683.html Sent from the FOP - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
Re: reduce size of PDF generated with FOP
Is it indeed? Well, the fact is that I generate PDFs in two different ways: - individual PDFs, - the same PDFs, but concatenated together into one big PDF, using the Apache pdfbox PDFMergerUtility.mergeDocuments() method. Compared to the ones generated by FrameMaker, the individual PDFs grow from 50-60 KB to 100-150 KB. In these PDF, the header and footer images are present only once. In the second case, the images are obviously repeated lots of times and the document grow from 1-2 MB to 23 MB. In this case, I assume that, as the images are originally part of separated document that were then merged, they are actually present lots of times in the global document. But, as I said before, images are not responsible for the huge size of the PDF alone, as when I remove them the PDF is still 21 MB. I'm afraid I am not at liberty to divulge the PDFs I'm referring to but I'll see if I can manage to generate a dummy one. That may not be easy. -- View this message in context: http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619p38648.html Sent from the FOP - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
reduce size of PDF generated with FOP
Hello everyone, I use Java, XSL-FO and FOP to generate PDFs that consist in one or more pages of data and images, each page having a header and a footer containing images themselves. These header and footer are repeated on each and every page of the PDF documents. The images are responsible for a large part of the size of the resulting PDF (about 50 %). I noticed that, by converting them from JPEG to TIFF, and by reducing their resolution, I was able to reduce considerably the size of the PDF as well. But I now have the feeling that I have reached a dead-end as far as images as concerned. The PDFs are still very huge, compared to those that used to be generated with FrameMaker, the Adobe PDF generation system that we're willing to get rid of. And I'm sorry to say that I can't think of another way to reduce the PDFs' size, as the Web mainly talks about pre-processing images in order to make PDFs smaller. I was wondering whether, maybe, it would be possible in a way or another to tell FOP to repeat the images in all headers and footers in some kind of way so that the images would be embedded only once in the document and just mirrored on the other pages. Plus, there ought to be other ways to reduce the PDF size, apart from images, don't you think? I would highly appreciate any advice on this topic. Thanks a lot in advance for your time and help. Erwann -- View this message in context: http://apache-fop.1065347.n5.nabble.com/reduce-size-of-PDF-generated-with-FOP-tp38619.html Sent from the FOP - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org