dim MyPDF, NewPDF, NewPDF_PageCount, pdfRect, i
'MyPDF is the PDF with documents we want to impose 2-up with telescoping on 11x17 paper.
'MyPDF is the current Job
Set MyPDF = Watch.GetPDFEditObject
MyPDF.Open Watch.GetJobFileName(), false
'NewPDF is the pdf on which MyPDF is to be imposed 2-up
Set NewPDF = Watch.GetPDFEditObject
NewPDF.Create Watch.GetJobFileName()
'NewPDF_PageCount is the theoretical page count of NewPDF
NewPDF_PageCount = round(MyPDF.Pages.Count/2)
if(NewPDF_PageCount < MyPDF.Pages.Count/2) Then
NewPDF_PageCount = NewPDF_PageCount + 1
End if
'pdfRect is used in the creation of the destination pages, which is 11x17, landscape
set pdfRect = CreateObject("AlambicEdit.PdfRect")
pdfRect.left = 0
pdfRect.top = 792
pdfRect.right = 1224
pdfRect.bottom = 0
For i = 0 to (NewPDF_PageCount-1)
'add the the 11x17 landscape page
NewPDF.Pages.Insert i, pdfRect
'merge it with 2 pages from MyPDF
NewPDF.Pages.Item(i).Merge2 MyPDF.Pages.Item(i), 0.0, 0.0, 0.0, 1.0
if ((i + NewPDF_PageCount) < MyPDF.Pages.Count) then
NewPDF.Pages.Item(i).Merge2 MyPDF.Pages.Item(i+NewPDF_PageCount), 612.0, 0.0, 0.0, 1.0
end if
Next
MyPDF.Close
NewPDF.Save False