Jump to content

save pdf generated by jasper report


sarita333

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

try this code by overridding postProcessReport method.

Code:
@Override      protected void postProcessReport(JasperPrint populatedReport, Map model) throws Exception {            System.out.println("Inside postProcessReport");            super.postProcessReport(populatedReport, model);             System.out.println("start download");            JRPdfExporter exporterPdf = new JRXlsExporter();			exporterPdf.setParameter(JRXlsExporterParameter.JASPER_PRINT,  populatedReport);			exporterPdf.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);			exporterPdf.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS,Boolean.TRUE);			//exporterPdf.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE);			exporterPdf.setParameter(JRXlsExporterParameter.OUTPUT_FILE_NAME, "D:/filename.pdf" );			exporterPdf.exportReport();			System.out.println("End download");      }
Link to comment
Share on other sites

  • 8 years later...

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...