This may be an old question, but I spent some time on how to compress PDF files and I want to share it ...
An alternative to the setParameter method is deprecated, and in order to do the same, the documentation indicates that you should use the PdfExporterConfiguration implementation . Provided with a simple SimplePdfExporterConfiguration and should be used as follows:
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setCompressed(true);
PDF XML :
Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream(PATH_XML));
Map params = new HashMap();
params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
params.put("parameterName", parameterValue);
JasperPrint jasperPrint = JasperFillManager.fillReport(PATH_JASPER, params);
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(PATH_PDF));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setCompressed(true);
exporter.setConfiguration(configuration);
exporter.exportReport();
4 1,9 , - , .