Set page orientation PDF BIRT report to landscape

Even if you have configured your BIRT report to be in landscape orientation, when you save it as a PDF, you may get portrait instead.

Using the tip from http://birtworld.blogspot.com/2009/05/change-page-layout.html, you can make your PDF landscape by going to Layout / Advanced / Report design / Before factory. Double click Before factory and paste in the javascript code you want.

The values for orientation can be landscape or portrait. Here’s an example:

var renderO = reportContext.getRenderOption().getOutputFormat();
// change layout
if (renderO == "pdf"){
    reportContext.getDesignHandle().getMasterPages().get(0).setProperty("orientation","landscape"); 
} else if (renderO == "html") {
    reportContext.getDesignHandle().getMasterPages().get(0).setProperty("orientation","landscape");
}

Click XML Source and verify that your code is present as you would expect:

Once you have entered the code, it might be easier to make updates using the XML Source view.