Hi,
I am using jasperreports-5.5.2. I have configured JRParameter.IS_IGNORE_PAGINATION as TRUE. When I export the report to PDF, I am getting correct ouput with say few hundreds of records. But, when I export to PDF and there are like thousands of record, I get output as blank PDF. I don't get any error in the background. Not even OutOfMemoryError.
Now, if I turn JRParameter.IS_IGNORE_PAGINATION as FALSE, I can export thousands of records successfully into PDF. Can somebody please tell me what can be a problem?
Here is the snippet of code used for exporting PDF.
ByteArrayOutputStream baos = new ByteArrayOutputStream(); net.sf.jasperreports.engine.JasperPrint jasperPrint = (net.sf.jasperreports.engine.JasperPrint)net.sf.jasperreports.engine.util.JRLoader.loadObject(reportFile); net.sf.jasperreports.engine.export.JRPdfExporter exporter = new net.sf.jasperreports.engine.export.JRPdfExporter(); exporter.setParameter(net.sf.jasperreports.engine.JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(net.sf.jasperreports.engine.JRExporterParameter.OUTPUT_STREAM, baos); exporter.exportReport();
Thanks in advance.
1 Answer:
Posted on August 10, 2016 at 7:49am
For Excel or HTML output should not be paginated.
parameters.put(JRParameter.IS_IGNORE_PAGINATION, true); - This is optional.It is not mandatory to pass this parameter for excel or html output
But for pdf,the output should be paginated .So we should put code as
parameters.put(JRParameter.IS_IGNORE_PAGINATION, false);