I have to prepare reports using five different sql queries. Each query will give out one report table.
So I wrote 5 jrxml files each corresponding to one of the abov
This answer is to help users with JASPER REPORT VERSION >5.6 (latest versions), hence remove the deprecated code.
Since jasper-report 5.6 JRPdfExporterParameter.JASPER_PRINT_LIST
is deprecated the current code of Wojtek Owczarczyk answer is:
List jpList = new ArrayList<>();
//add your JasperPrint's from loading jrprint or more
//commonly filling report with JasperFillManager.fillReport
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(jpList)); //Set as export input
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(stream)); //Set output stream
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
//set your configuration
exporter.setConfiguration(configuration);
exporter.exportReport();