Print pages range with Jasper 6

0

With previous version I wrote:

JRPrintServiceExporter pse = new JRPrintServiceExporter();
pse.setParameter(JRPrintServiceExporterParameter.JASPER_PRINT, Job.jrPrint );
pse.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, Printer.getService() );
pse.setParameter(JRExporterParameter.START_PAGE_INDEX, startPage-1);
pse.setParameter(JRExporterParameter.END_PAGE_INDEX, endPage-1);
pse.exportReport();

With new version, I use "SimplePrintServiceExporterConfiguration" to configure printing, but I don't find how to set start / end page

JRPrintServiceExporter pse = new JRPrintServiceExporter();
SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration();
configuration.setPrintService(printService);
pse.setConfiguration(configuration);          
pse.setExporterInput(new SimpleExporterInput(jasperPrint));
pse.exportReport();


ddaitarn304's picture
Joined: Sep 9 2015 - 6:39am
Last seen: 7 months 3 weeks ago

1 Answer:

0

Following should set the page number range but it seems JasperReports is overriding the property setting to select all pages. Seems like a bug.

printRequestAttributeSet.add(new PageRanges("1-2"));

hozawa's picture
49093
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 months 1 week ago
Feedback