Jump to content
Changes to the Jaspersoft community edition download ×

outofmemoryError when exporting PDF files


Recommended Posts

I'm using iReport 1.3.3 to develop my report with PDF as output format and XML as data source.


When I using iReport to export the report to PDF file, everything is alright.


However, when I try to use the jasper library to run the report by writing a testing program, out of memory error occurred:

[java] java.lang.OutOfMemoryError

[java] Exception in thread "main"


After I traced the code, I found that the error occurred when calling the the function

"JasperRunManager.runReportToPdfFile(String sourceFileName, Map parameters)"

I've also tried to fill the report to a jasperPrint file and use JasperExportManager.exportReportToPdfFile(JasperPrint jasperPrint, String destFileName) to export the pdf file but the result was the same. The JasperReport library I used is version 1.3.3.

However, if I tried to export the report to HTML file no problem occurred.


Could anyone give me some hint about why the report can be run in iReport but not by calling it using JasperReport api?


Or do anyone know the underlaying mechanism of how iReport generating the report?




Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

There are two steps you can try.

(1) allow more memory for the java application.,

Usually, Java uses only 64MB ... you can pass


to the java virtual machine call; then, 128MB are used.

If this solves your problem, you can probably live with it ... I don't know how much memory iReport usually uses, but surely more than the default 64 MB. (I just checked, it's 512m.) Thus, iReport runs your report, while your app doesn't.

HTML probably uses less memory than pdf.


(2) Use a virtualizer for rendering the report.

I've never used one, so I can't really help you on this one, but searching for virtualizer in the forum, the wiki and/or other documentation will surely help you there, if your report is really so large a few more megabytes don't make it.

There's JRFileVirtualizer and JRSwapVirtualizer, e.g.


Hope this helps,


Post edited by: csbac, at: 2007/08/15 21:26

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...