Wednesday, May 27, 2009

Change Page Layout

Been busy writing reports lately, but I thought that I would try to publish a few quick tips that I have turned up.

One of the issues I have faced is that when a report is being formatted for PDF layout, I want it to be constrained to the page dimensions and to have it in portrait style. At the same time, when it is displayed for HTML, I want to have it in Landscape mode since the rendering seems to be better for HTML.

This little section of script placed in the beforeFactory method of the ReportItem will do that for you.

var renderO = reportContext.getRenderOption().getOutputFormat();
// change layout
if (renderO == "pdf"){
} else if (renderO == "html")


Anonymous said...


Anonymous said...

This cut off some of the columns of info in the pdf.

Anonymous said...

Could you make the same but only for a table data component? I mean, I want a report in portrait orientation but only one table in landscape. is it possible?

Thanks in advance.

Jason Weathersby said...

yes. Just make two master pages. On the one table, click the page break property and set its master page to the one you made landscape.