Java 8 SimplePdfReportConfiguration Setting PDF Title Not Working.

0

I'm using Java 8 with the net.sf.jasperreports.export.SimplePdfReportConfiguration class to generate a PDF from a template.

All is working fine, except the when I exportConfig.setMetadataTitle("Invoice 29Sep2019 Example Co., Inc.") it does not get set. When viewing the downloaded PDF properties, the Title is empty. See scrn shot below.

Plus, the name given to the PDF looks like a UUID. For example, 2a7f08fa-f6d1-4a0c-9cfe-714db849a124.pdf.

Any ideas?

Thanks,

Java Code:

            JRDataSource dataSource = getDataSource(invoiceDOList);
            JasperReport report = getReport(templateXML);
            JasperPrint jasperPrint = JasperFillManager.fillReport(report, null, dataSource);
 
            JRPdfExporter exporter = new JRPdfExporter();            
            exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
 
            SimplePdfReportConfiguration reportConfig = new SimplePdfReportConfiguration();
            reportConfig.setSizePageToContent(true);
            reportConfig.setForceLineBreakPolicy(false);
 
            SimplePdfExporterConfiguration exportConfig = new SimplePdfExporterConfiguration();
            exportConfig.setMetadataAuthor("BobC");
            exportConfig.setMetadataTitle("Invoice 29Sep2019 Example Co., Inc.");
            exportConfig.setAllowedPermissionsHint("PRINTING");
 
            exporter.setConfiguration(reportConfig);
            exporter.setConfiguration(exportConfig);

PDF Properties Scrn Shot:

bobc02's picture
5
Joined: Sep 22 2019 - 6:17pm
Last seen: 1 year 6 months ago

Hi,

I've the same, have you solved it ?

Thks.

BOFR - 8 months 1 day ago

0 Answers:

No answers yet
Feedback