2
如何在运行时在Jasper中设置导出pdf版本?如何在运行时更改Jasper Reports PDF版本
如何在运行时在Jasper中设置导出pdf版本?如何在运行时更改Jasper Reports PDF版本
对于您的实例JRPdfExporter
,请调用方法setParameter
并使用JRPdfExporterParameter
中定义的常量来适当地设置版本。
实施例:
exporter.setParameter(JRPdfExporterParameter.PDF_VERSION, JRPdfExporterParameter.PDF_VERSION_1_2);
有1.2 1.7通过版本常数。
为您的代码,解决办法是这样的:
JasperPrint print = JasperFillManager.fillReport(jasperReport, param, con);
File outputFile = new File("[Your destination filename goes here]");
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE, outputFile);
exporter.setParameter(JRPdfExporterParameter.PDF_VERSION, JRPdfExporterParameter.PDF_VERSION_1_2);
exporter.exportReport();
PDF格式将被写入outputFile
,这样你就不会需要调用printReport
。
我的代码如下:\t \t \t JasperPrint打印= JasperFillManager.fillReport(JasperReport的, \t \t \t \t \t PARAM,CON); \t \t \t printReport(data,request,print);在此之后,我必须为出口者创建对象并设置参数? – Karthick
@Karthick我已经用特定的代码示例更新了我的答案。希望有所帮助。 – GenericJon
请帮助下面的链接:http://stackoverflow.com/questions/8269631/unwanted-helvetica-font-is-using-in-pdf-by-jasper。非常感谢。 – Karthick