我如何申请IS_COMPRESSED = true
属性应用到 Jasper PDF 报告?
这就是我所拥有的,但是当我创建 PDF 报告时,它的大小与未启用压缩的克隆相同:
File pdfFile = new File (pdfDirectory.getAbsolutePath() + File.separator + reportName + ".pdf");
File jrPrintFile = new File(jrprintFileLocation.getAbsolutePath() + File.separator + templateName + ".jrprint");
JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(jrPrintFile);
JRPdfExporter jrPdfExporter = new JRPdfExporter();
jrPdfExporter.setParameter(JRPdfExporterParameter.IS_COMPRESSED, true);
jrPdfExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
jrPdfExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, pdfFile.getAbsolutePath());
jrPdfExporter.exportReport();