title: Combining two Jasper reports
body: <p>I have a web application with a dropdown from where user could select the type of report viz. report1, report2, report3, etc. </p>
  
  <p>Based on the report selected, a Jasper report is compiled on the server and opens as a pop up in PDF format. </p>
  
  <p>On the server side, I am implementing each report in a separate method using below code say for e.g. for report1:</p>
  
  <pre class="lang-java prettyprint-override"><code>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);
  </code></pre>
  
  <p>Similarly, report2 is in a separate method with below code:</p>
  
  <pre class="lang-java prettyprint-override"><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);
  </code></pre>
  
  <p>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.</p>
  
  <p>How can I combine above two lines of codes to finally generate a single PDF?</p>