Java Jasper报告导出PDF失败

时间:2018-10-31 09:48:22

标签: java groovy jasper-reports

我无法导出PDF以获取帮助。

我在开发环境中运行了它,并且运行良好,但是当我进入生产环境(使用WebSphere和Tomcat服务器)时,它与PDF崩溃了,excel仍然可以正常运行。

代码如下:

 fileName+= DateProc.getYYYYMMDDHHMMSSString(DateProc.createTimestamp()) + ".pdf"
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
ByteArrayOutputStream os = new ByteArrayOutputStream();
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(os));
println("exporter:" + exporter)
exporter.exportReport(); --> running here stop, do not shoot out errors
println("done")
render downloadFileService.downloadReport(fileName, os.toByteArray()) //process download file

我尝试了以下代码,但也失败了:

    fileName+= DateProc.getYYYYMMDDHHMMSSString(DateProc.createTimestamp()) + ".pdf"
byte[] outArray = JasperExportManager.exportReportToPdf(jasperPrint);
render downloadFileService.downloadReport(fileName, outArray)



java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V 
net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:480) 
net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:379) 
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:122) 
ReportServlet.processRequest(ReportServlet.java:104) 
ReportServlet.doGet(ReportServlet.java:142) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:690) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

我使用以下库: -iText-2.1.7.js2.jar -itext-4.2.0.jar -itextpdf-5.5.0.jar -jasperreports-5.6.0.jar -jasperreports-fonts-5.6.0.jar -jasperreports-javaflow-5.6.0.jar

谢谢

0 个答案:

没有答案