Home
Analytics
Header in First Page Only (when exported to .pdf)
onthegomiller
<p>Hello,</p>
<p> </p>
<p>I'm trying to get three (3) rows of a header to only display on the first page of a report when the report is exported to .pdf.</p>
<p> </p>
<p>Is this possible?</p>
<p> </p>
<p>I found the topic w/in the Forum that talked about putting the following code into the onRender script:</p>
<div>if(pageNumber>1){</div>
<div>this.getStyle().display ="none"</div>
<div>}</div>
<div> </div>
<div>I tried this for the three rows and they still display on all pages when exported to .pdf (they don't display when just being run w/in BIRT itself).</div>
<div> </div>
<div>I also tried the same code in the Visibility Property (hiding the row). That didn't work there either.</div>
<div> </div>
<div>As a final try, I just added "pageNumber > 1" to the Visibility Property (again hiding the row) for the top three rows of the report but they still all display on every page.</div>
<div> </div>
<div>This has to be simpler to accomplish than it appears?</div>
<div> </div>
<div>Any guidance is greatly appreciated! I've attached a copy of the report. I still have the code w/in the onRender script as well as w/in the Visibility Property.</div>
<div> </div>
<div>Thank you!</div>
Find more posts tagged with
Comments
mwilliams
Try this report. Check out the onRender script for the table's header row.
onthegomiller
<p>Hi Michael,</p>
<p> </p>
<p>So, I added the example of code you sent me (verbatim) to the 3 Table Header Rows within my report. Those 3 rows still display on every page when exported to .pdf</p>
<p> </p>
<p>Maybe I missed something? I didn't see any additional code w/in the sample report you sent.</p>
<p> </p>
<p>You code is straightforward and simple enough so I must be missing something?</p>
<p> </p>
<p>Thank you.</p>
<p> </p>
<p> </p>
mwilliams
Are you exporting to PDF from the viewer? Or running directly to PDF from the run as drop down? If directly to pdf, try exporting from the viewer. Or run in the viewer, then change the url parameter format to pdf.
onthegomiller
<p>Yikes, this is a dumb question but how do I export from the viewer? I only see an option to print or save to .pdf from the viewer. I don't see an option to export (after running via the 'run as' dropdown). I tried right clicking on it but no luck. When I save it, it includes the header on all pages. Also, when I import into IBM Maximo and export to .pdf from the viewer there (after running from w/in the UI), it prints the header on all pages of the .pdf as well. </p>
mwilliams
When you run the report in the web viewer, there should be an export report option in the toolbar.<br><br>
onthegomiller
<p>Found it (was running directly to .pdf from w/in BIRT so I didn't initially see the export option). Ran w/in the viewer and then could see the export.</p>
<p> </p>
<p>However, the 3 Table Header Lines still display on every page. I've attached a screen shot (of the first two pages). I was hoping for those 3 first lines to display only on the first page and then the blue header on the first as well and every page thereafter.</p>
<p> </p>
<p>Any ideas on why the code isn't working?</p>
mwilliams
Can you create a report that I can run that has the issues you're having?
onthegomiller
<p>Let me give that a try. I will send you a copy shortly.</p>
<p> </p>
<p>Thank you!!</p>
mwilliams
Sounds good!
uttambirt
<p>HI Michael i tried your solution i mean exporting from web viewer to PDF its working , actually my requirement is to hide the header in first page and to show them in all other pages. so i used the code in this way in on render method</p>
<p> </p>
<p>if(reportContext.getRenderOption().outputFormat == "pdf"){<br>
if(pageNumber == 1){<br>
this.getStyle().display = "none";<br>
}<br>
}</p>
<p> </p>
<p>But does this solution work from browser , i mean report runs from application browser and then export to PDF .</p>
<p> </p>
<p>and is there any direct solution i mean even if the report executed directly , my requirement is to hide the header element only in first page and display in 2,3,4 etc pages. thanks</p>