问题
I want to handle huge data in creating PDF, I know there is a thing called Virtualizers in Jasper Reports, but i don't know how to handle the out of memory exception that is fired when i retrieve the data from the DAOs, I don't know how to implement pagination in Jasper reports datasources.
回答1:
To understand Virtualizers you can read "Large File Support" section of Jasper Reports Ultimate Guide (available here: http://community.jaspersoft.com/documentation).
Example of JRSwapFileVirtualizer usage can be found here: how to select and configure a JasperReports virtualizer?.
If you're still running out of memory, you may need to increase the memory limit using -Xmx JVM option (in server startup script or eclipse run configuration arguments - depends on your environment), for example:
-Xmx1024M
回答2:
You need a custom implementation of JRDatasource and a Virtualizer, Your implementation of JRDatasource should load data in chunks
You can set net.sf.jasperreports.jdbc.fetch.size in jasperreports.properties too, if you are using JRResultSetDataSource
来源:https://stackoverflow.com/questions/19476535/handle-huge-data-in-jasper-reports-pagining