How to print Only first N pages in Jasper Report

0

I have a big report that generate something like 8000 pages. I want to input a limit to maximum page generation. For example to print only the first 100 out of 8000 pages.

I've tried to add net.sf.jasperreports.governor.max.pages and net.sf.jasperreports.governor.max.pages.enabled but it throw a exception and not return only first 100 page. 

Adding for all element Print When Expression PAGE_NUMBER < 100 have some big cons:

  1. Need to sum sub-reports page numbers
  2. There are a lot of elements and adding Print When Expression to all of them don't looks good

Thanks.

ilie.cristian.work's picture
Joined: Jan 23 2018 - 9:45am
Last seen: 2 years 1 day ago

2 Answers:

1

If your report pages doesn't have information like total number of pages in them, why not just retrict your data? If you're using sql, you can just set limit and offset.

hozawa's picture
56522
Joined: Apr 24 2010 - 4:31pm
Last seen: 7 months 2 weeks ago

 Is there no other option ? 
Because I loose a lot of performance generating JRPrint with 8000 pages and only after that to print  first 100 pages

ilie.cristian.work - 2 years 1 day ago
1

It's not part of the jrxml specification but part of a program that prints the pages.

If you develop your own report printing program using JasperReports library, just specify first page to print and last page to print in JasperPrintManager.printPages() method.

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

hozawa's picture
56522
Joined: Apr 24 2010 - 4:31pm
Last seen: 7 months 2 weeks ago
Feedback
randomness