BIRT: Fit to whole page in report design?

2.9k views Asked by At

I have a report and want to fix it to 1 page (A4) regardless of the number of rows in the table. Usually it's 10 rows but can be more in some cases.

Anyway I need to use BIRT in a fixed context (3rd party application), eg. no option to adjust the BIRT viewer or url params. Therefore how can I add this option to my report design so that it is applied automatically?

1

There are 1 answers

1
Dominique On BEST ANSWER

I don't think it is possible to force a render option from the report-design. If it was it would probably achieved by using this code fragment from "beforeRender" script of the report:

importPackage(Packages.org.eclipse.birt.report.engine.api);
reportContext.getRenderOption().setOption(IPDFRenderOption.PAGE_OVERFLOW,IPDFRenderOption.FIT_TO_PAGE_SIZE);

I tried it, it appears at this stage the BIRT task has already applied render options and therefore this new value is ignored.

If you have access to the source code of this third party app it is quite easy to add a "Fit to" PDF render option.

Otherwise you will have to change the report-design and make it a little bit more dynamic: there are many design tips allowing to fit a report in a single page, one of them is to change the height of some items by script depending on the number of rows of the table.