This is the script I use to rotate Landscape pages to Portrait for PDFs with mixed plex. It works, but on large files it seems to get exponentially slower as it goes. On a particular job with 21,000 pages it is taking HOURS to complete. Is there a faster way to do this:
dim myPDF, myRotatedPDF, myRect
dim x, pageHeight, pageWidth, tempright, myRotatedPDFName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(Watch.GetJobFilename())
tempFileName = objFSO.GetParentFolderName(objFile) & "\" & objFSO.GetTempName
Set myPDF = Watch.GetPDFEditObject
myPDF.open Watch.GetJobFileName,false
Set myRotatedPDF = Watch.GetPDFEditObject
myRotatedPDF.create tempFileName
Set myRect = CreateObject("AlambicEdit.PdfRect")
for x = 0 to myPDF.Pages.Count-1
Set myRect = myPDF.Pages(x).size
pageWidth = myRect.Right
pageHeight = myRect.Top
if (pageWidth < pageHeight) then
myRect.Bottom = 0
myRect.Left = 0
myRect.Top = 792
myRect.Right = 612
myRotatedPDF.Pages.insert x, myRect
myRotatedPDF.Pages(x).merge2 myPDF.Pages(x),0,0,0,1
else
tempright = myRect.Right
myRect.Right = myRect.Top
myRect.Top = tempright
myRotatedPDF.Pages.insert x, myRect
myRotatedPDF.Pages(x).merge2 myPDF.Pages(x),0,myRect.Top,90,1
end if
next
myPDF.Close
myRotatedPDF.save true
myRotatedPDF.Close
objFSO.DeleteFile Watch.GetJobFileName()
objFSO.MoveFile tempFileName, Watch.GetJobFileName
set myRect = nothing
set myPDF = nothing
set objFile = nothing
set objFSO = nothing