I tried answer from this site to merge two jrxml jasper into 1 pdf file. Created file contain two page...
How to merge two jrxml into one page?
JasperPrint jasperPrint1 = JasperFillManager.fillReport(getClass().getResourceAsStream("/coba.jasper"), param, new JREmptyDataSource());
JasperPrint jasperPrint2 = JasperFillManager.fillReport(getClass().getResourceAsStream("/coba2.jasper"), param2, new JREmptyDataSource());
List pages = jasperPrint2.getPages();
for (int i = 0; i < pages.size(); i++) {
JRPrintPage object = (JRPrintPage)pages.get(i);
jasperPrint1.addPage(object);
}
JRExporter exporter = new JRPdfExporter();
exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, jasper);
OutputStream output = new FileOutputStream(new File("d:\demo.pdf"));
exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, output);
exporter.exportReport();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…