List<JasperPrint> jasperPrints = new ArrayList<JasperPrint>();// Your pre to get Jasperreport objectsJasperReport jasperReportReport1 = JasperCompileManager.compileReport(jasperDesignReport1);jasperPrints.add(jasperReportReport1);JasperReport jasperReportReport2 = JasperCompileManager.compileReport(jasperDesignReport2);jasperPrints.add(jasperReportReport2);JasperReport jasperReportReport3 = JasperCompileManager.compileReport(jasperDesignReport3);jasperPrints.add(jasperReportReport3);JRPdfExporter exporter = new JRPdfExporter();//Create new FileOutputStream or you can use Http Servlet Response.getOutputStream() to get Servlet output stream// Or if you want bytes create ByteArrayOutputStreamByteArrayOutputStream out = new ByteArrayOutputStream();exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrints);exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);exporter.exportReport();byte[] bytes = out.toByteArray();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)