Script to rotate only landscape pages

Hi

The datamapper function steps.currentPageWidth / Height are not working on pdf’s creted with ghost scripts where the pages are mixed Portrai/Landscape.

All page PageWidth/Height are comming out the same from the datamapper. So the Connect layout can’t be controlled.

Tried a javascript whitch looked like this:
var pdf = Watch.GetPDFEditObject();
pdf.Open(Watch.GetJobFileName(),false);
for (i=1; i <= pdf.Pages().Count(); i++){
Var Test =pdf.getPageRotation(i);
if (Test == 90){
pdf.Pages(i).Orientation = 90;
}
}
pdf.Save(false)

Hoped that this script could rotate only landscape pages, but it is not working.
Var Test =pdf.getPageRotation(i); can’t be compiled by pp.

Any hints ?

Try with

var Test = pdf.Pages(i).Orientation;

Thanks

Ended up with this - and it is working.

var pdf = Watch.GetPDFEditObject();
var test
pdf.Open(Watch.GetJobFileName(),false);
for (i=0; i < pdf.Pages().Count(); i++)
{
Test = pdf.Pages(i).Orientation;
if (Test == 90)
{
pdf.Pages(i).Orientation = 0
}
}
pdf.Save(false)