theonlysood Posted August 2, 2017 Posted August 2, 2017 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);[/code]exporter.setExporterInput(SimpleExporterInput.getInstance(printEntry.getValue()));exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(mFile));exporter.exportReport();[/code]Thanks in advance!
hozawa Posted August 2, 2017 Posted August 2, 2017 If you look at the javadoc, it said to to use ReportExportConfiguration.getPageIndex().http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRExporterParameter.htmlSince you're suing SimplePdfExporterConfiguration, have you tried using setPageIndex?http://jasperreports.sourceforge.net/api/net/sf/jasperreports/export/SimpleReportExportConfiguration.html#setPageIndex-java.lang.Integer-
theonlysood Posted August 3, 2017 Author Posted August 3, 2017 @hozawaThanks for the answer. I could use SimplePdfReportConfiguration successfully!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now