将JasperReport导出到PDF OutputStream?

将JasperReport导出到PDF OutputStream?,第1张

将JasperReport导出到PDF OutputStream?

好的,这就是它的工作原理。

JasperFillManager
实际上返回一个
JasperPrint
对象,因此:

// get the JRXML template as a streamInputStream template = JasperReportsApplication.class    .getResourceAsStream("/sampleReport.xml");// compile the report from the streamJasperReport report = JasperCompileManager.compileReport(template);// fill out the report into a print object, ready for export. JasperPrint print = JasperFillManager.fillReport(report, new HashMap<String, String>());// export it!File pdf = File.createTempFile("output.", ".pdf");JasperExportManager.exportReportToPdfStream(print, new FileOutputStream(pdf));

享用



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5350501.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-09
下一篇 2022-12-09

发表评论

登录后才能评论

评论列表(0条)

保存