Home
Analytics
Get the Pagenumber from PDF Reports
voller
Hi!
I have to do different things depending on page count of PDF Report.
How can I grab the actual pagenumber? The JS-Value PageNumber does not work anymore (is always 1, although we have a 7 site report??)
Thanks a lot for any info and have a nice weekend
chris
Find more posts tagged with
Comments
mwilliams
Hi Chris,
Can you explain more of what you're wanting to do so that I might be able to offer a solution? Thanks
voller
Sorry!
We have to generate a PDF-Report with different Master-Page-Header-Views on the first page and on the following pages! On first page we want to show in more detail, company-logo, report-title, department, date/time,...! On the following pages, just the report-title and date/time. For this reason we have designed a grid in Masterpage with different rows.
At Birt 2.1.2, it was possible to use pageNumber < 2 at visibility/ hide section for a row to switch visibility. In Birt 2.3.2 this does not work anymore because pageNumber is always 1 (we have a test report with 7 pages).
So my question: is there any possibility to get the actual pagecount,...
thanks a lot
chris
mwilliams
Chris,
Unfortunately, the masterpage is only rendered once, which is why the pageNumber is always '1' in the masterpage. So, you won't be able to change the visibility. If you have items that are specific to the first page of the report, you could create 2 master pages and assign them to the appropriate report elements.
voller
Hi Michael!
Thanks a lot for your help!! I have done some tests. In a way it should be possible to get the pagenumber of the report (not the Masterpage). Because at the end of a PDF Report there is a PageCount/TotalPage. So, do you know, how do get the actual Pagecount of a report in PDF view?? (Maybe in the PageBreake Event??)
Furterhmore...
I have done some tests with JSScripting:
var designhandle = reportContext.getDesignHandle();
var gridhandle = designhandle.findElement("TestGrid");
if(gridhandle)
{
var rowsslot = gridhandle.getRows();
rowsslot.drop(1);
}
This script finds a Grid with name "TestGrid" and drops the second row! This is working fine, if I define the Grid in my report, but it does not work, if I define the Grid in a Library and link this library to my report. "TestGrid" is not found.
Wrapped org.eclipse.birt.report.model.api.command.ContentException: Element "Grid("TestGrid")" is child element or a virtual element( inside the child ), can not change its structure. (/report/method[
@name="
;beforeRender"]#12).
at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:307)
at o
...
Do you know how do find an element in a Library and drop, for example, a row??
All in all I want to check if the pagenumber is >1 and the I want do drop a row in my Library Masterpage!!
Thanks a lot again for your help
Chris
mwilliams
Chris,
The autotext value that updates is the only thing that updates in the masterpage, which is what you see at the end of the report giving the correct page numbers. Within the report layout, you can grab or display the page number with the variable pageNumber.
prakash_p
When I came to know that there is no straight way to grab current page number from master page element, I am a little disappointed. Can't it be a pretty straight forward thing?
mwilliams
This is something that could be requested as a feature in future releases by going to <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/reportabug.php'>BIRT
: Reporting Bugs and Requesting Enhancements</a>. It may already be in the works, but if not, it'd be worth requesting.