Break the PDF document after 100 pages

戏子无情 提交于 2019-12-02 09:39:03

问题


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 please help me? How can I generated the 100 page PDF document?


回答1:


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.



回答2:


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.



来源:https://stackoverflow.com/questions/577197/break-the-pdf-document-after-100-pages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!