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 report is compiled on the server and opens as a pop up in PDF format.
On the server side, I am implementing each report in a separate method using below code say for e.g. for report1:
JRBeanCollectionDataSource report1DataSource = new JRBeanCollectionDataSource(resultSetBeanListReport1);
InputStream inputStreamReport1 = new FileInputStream(request.getSession().getServletContext ().getRealPath(jrxmlFilePath + "report1.jrxml"));
JasperDesign jasperDesignReport1 = JRXmlLoader.load(inputStreamReport1);
JasperReport jasperReportReport1 = JasperCompileManager.compileReport(jasperDesignReport1);
bytes = JasperRunManager.runReportToPdf(jasperReportReport1, titleMapReport1, report1DataSource);
Similarly, report2 is in a separate method with below code:
JRBeanCollectionDataSource invstSummDataSource = new JRBeanCollectionDataSource(resultSetBeanListInvstOfSumm);
InputStream inputStreamInvstSumm = new FileInputStream(request.getSession().getServletContext().getRealPath(jrxmlFilePath + "investSummary.jrxml"));
JasperDesign jasperDesignInvstSumm = JRXmlLoader.load(inputStreamInvstSumm);
JasperReport jasperReportInvstSumm = JasperCompileManager.compileReport(jasperDesignInvstSumm);
bytes = JasperRunManager.runReportToPdf(jasperReportInvstSumm, titleMapInvstSumm, invstSummDataSource);
Now I have a requirement that if report1 is selected from the dropdown, the resulting PDF should contain all the reports one after other in the same PDF.
How can I combine above two lines of codes to finally generate a single PDF?