Exporting each JRPrintPage to separate PDF

0

I am using JasperReports for one of my projects in Java to generate PDF reports.

My requirement is to export each page in a JasperPrint to separate PDF file

Since JRExporterParameter.PAGE_INDEX export parameter is deprecated and I am unable to set configuration.

Please help me on how can I specify the page range simply while exporting ?

 

 

This is my sample code:

JRPdfExporter exporter = new JRPdfExporter(DefaultJasperReportsContext.getInstance());
SimplePdfExporterConfiguration config = new SimplePdfExporterConfiguration();
config.setCreatingBatchModeBookmarks(true);
config.setCompressed(true);
exporter.setConfiguration(config);
exporter.setExporterInput(SimpleExporterInput.getInstance(printEntry.getValue()));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(mFile));
exporter.exportReport();

Thanks in advance!

theonlysood's picture
Joined: Aug 2 2017 - 6:12am
Last seen: 2 years 5 months ago

2 Answers:

1

If you look at the javadoc, it said to to use ReportExportConfiguration.getPageIndex().

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRE...

Since you're suing SimplePdfExporterConfiguration, have you tried using setPageIndex?

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/export/Sim...

 

hozawa's picture
56232
Joined: Apr 24 2010 - 4:31pm
Last seen: 7 months 1 week ago
0

 

 

@hozawa

Thanks for the answer. I could use SimplePdfReportConfiguration successfully! 

 

theonlysood's picture
Joined: Aug 2 2017 - 6:12am
Last seen: 2 years 5 months ago
Feedback