Script for PDF files - Rotate all pages that are landscape

hi there,

I noticed this script and it works a charm for PDFs that are always the same page numbers.

var PDF = Watch.GetPDFEditObject();
PDF.Open(Watch.GetJobFileName(),false);

PDF.Pages(1).Orientation = 270;
PDF.Pages(2).Orientation = 270;
PDF.Pages(3).Orientation = 270;

PDF.Save(true);
PDF.Close();

What if you have 6 files (that will eventually be merged) where file 1 == portrait, file 2 == portrait, but file 3 and file 4 == landscape. File 5 and 6 are portrait again. I need to make the files that are landscape into portrait, then will merge together with other files.

Thanks,

Cecile

Hi Cecile,

Try this code. It works but there is one error. I have commented out the pdf.close(); line because it keeps giving me a “unable to close PDF file error”. I poked around on the net and was not able to find a quick answer why I get the error. I will look into it later or perhaps someone with a little bit more Alambic API experience can chime in.

var pdf = Watch.GetPDFEditObject();

pdf.Open(Watch.GetJobFileName(),false);

for (i=0; i < pdf.Pages().Count(); i++){
pdf.Pages(i).Orientation = 270;
}
pdf.Save(true);
//pdf.close();

Regards,

S