I have a web application with a dropdown from where user could select the type of report viz. report1, report2, report3, etc.
Based on the report selected, a Jasper
This answer is to help user using latest version of Jasper-Report. In @Sangram Jadhav accept answer the JRExporterParameter.JASPER_PRINT_LIST is deprecated
The current code would be:
Map paramMap = new HashMap();
List jasperPrintList = new ArrayList();
JasperPrint jasperPrint1 = JasperFillManager.fillReport(report1, paramMap);
jasperPrintList.add(jasperPrint1);
JasperPrint jasperPrint2 = JasperFillManager.fillReport(report2, paramMap);
jasperPrintList.add(jasperPrint2);
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList)); //Set as export input my list with JasperPrint s
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("pdf/output.pdf")); //or any other out streaam
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setCreatingBatchModeBookmarks(true); //add this so your bookmarks work, you may set other parameters
exporter.setConfiguration(configuration);
exporter.exportReport();