Break the PDF document after 100 pages

前端 未结 2 470
囚心锁ツ
囚心锁ツ 2021-01-25 08:11

I am working with JasperReports and iReport tool. One of the requirements the client wants is that the PDF file will be generated to a 100 page document only.

Could you

相关标签:
2条回答
  • 2021-01-25 08:13

    As @WEG mentioned in the answer for JasperReport size limit question it can be done with help of this parameters:

    • net.sf.jasperreports.governor.max.pages.enabled - a flag indicating whether the governor that checks if a report exceeds a specified limit of pages is turned on. With this property enabled, the JR engine will stop the report execution if the number of pages becomes greater than a custom given value;
    • net.sf.jasperreports.governor.max.pages - if the governor that checks if a report exceeds a specified limit of pages is turned on, this property will indicate the maximum number of pages allowed to be ran, in order to prevent a memory overflow error. If the number of pages in the report becomes greater than this value, the report execution will be stopped;
    • REPORT_MAX_COUNT - an integer allowing limit the datasource size.
    0 讨论(0)
  • 2021-01-25 08:30

    In the iReport you can find a built in variable PAGE_COUNT. For every element in the detail band you can put the following in the "Print when expression" textbox:

    Boolean.valueOf($V{PAGE_COUNT}.intValue() < 100)
    

    This will stop printing after page number 100.

    0 讨论(0)
提交回复
热议问题