Jump to content
Changes to the Jaspersoft community edition download ×

Java 8 SimplePdfReportConfiguration Setting PDF Title Not Working.


Recommended Posts

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?


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);[/code]

PDF Properties Scrn Shot:

Link to comment
Share on other sites

  • 10 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...