PDF export is blank with huge data.

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.
uhkudale's picture
Joined: Jun 27 2014 - 1:16am
Last seen: 5 years 3 months ago

1 Answer:

 
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); 
Vishnu K V's picture
Joined: Aug 26 2015 - 10:49pm
Last seen: 6 years 4 months ago
Feedback
randomness