Jaspersoft / jasperreports-pdf-lib7

GNU Affero General Public License v3.0
8 stars 8 forks source link

how to use com.jaspersoft.jasperreports.export.pdf.modern.ModernPdfProducerFactory programmatically #6

Closed richso closed 2 years ago

richso commented 2 years ago

When using with Jasperreport Library programmatically, how can we change the default PDF producer to this alternative producer?

i.e. com.jaspersoft.jasperreports.export.pdf.modern.ModernPdfProducerFactory

dadza commented 2 years ago

You can set the PDF producer property programmatically like this:

DefaultJasperReportsContext.getInstance().setProperty(JRPdfExporter.PDF_PRODUCER_FACTORY_PROPERTY, 
        "com.jaspersoft.jasperreports.export.pdf.modern.ModernPdfProducerFactory");

You can also use ModernPdfProducerFactory.class.getName() as property value if you don't mind a compile dependency.