I don’t do perfect binding, so I don’t have or know of tools that will do what is needed to paginate for cut and stack layout. The Fiery print controller will do that, but only 2-up. Which is fine until you need 4-up. So to do that I needed a 2-up file that could then also be printed 2-up. Clear as mud, as they say.
So no tools and no idea of tools and no desire to pay for said tools I turned to scripting InDesign, which is fairly robust. InDesign CC ships with a set of scripts in both javascript and AppleScript. I went with the AppleScript version of PlaceMultipagePDF and massaged it to do what I wanted. I’m sure a javascripter could work out a translation.
How it works or expects to work: It runs through all pages of a PDF, no page selection available, but I suppose you could code it in. It starts at page “1” of an InDesign document and places page 1 of the PDF on the left half at 0 inches x and 0 inches y, creates page “2” if needed and places page 2 of the PDF on the right side at (width/2) inches x and 0 inches y, etc. until it reaches the halfway point of the PDF pages, then it moves back to page “1”, right then left, down the document pages.
It throws an error if run from Script Editor, but from the script menuextra stays silent. The {x,y} position can be hard coded of course. Relies on pdfinfo to get the number of pages in the PDF you want to place. I don’t know if pdfinfo is included in any version of macOS, but in mine it is from macports.org as reflected by the path. [sidenote]It is also possible to export your $PATH and the start of a do shell script command in AppleScript.[/sidenote] There is a setting for a margin. Should probably be prompted for it…maybe later. Done.
-- strawhousepig.net
-- Based on PlaceMultipagePDF.applescript (An InDesign AppleScript)
--
--For more on InDesign/InCopy scripting see the documentation included in the Scripting SDK
--available at http://www.adobe.com/devnet/indesign/sdk.html
--or visit the InDesign Scripting User to User forum at http://www.adobeforums.com.
--
-- For punching or drilling holes.
set myPDF to choose file "Select a PDF file to place"
try
set myMargin to (text returned of (display dialog "Enter amount of left-side binding margin (inch decimal)." & return & return & "Your InDesign document should have twice this amount in additional width." default answer 0)) as integer
on error theErr
display alert theErr
return
end try
set nPDFpages to do shell script "/opt/local/bin/pdfinfo " & quoted form of POSIX path of myPDF & " | grep Pages: | sed -E 's/.+ ([0-9]+)/\\1/'"
set firstHalfPDF to (round (nPDFpages / 2))
set secondHalfPDF to firstHalfPDF + 1
--log nPDFpages & " " & firstHalfPDF & " " & secondHalfPDF
tell application "Adobe InDesign 2025"
if (count documents) > 0 then
set myDocument to active document
tell myDocument to set myPage to page "1"
set myStepA to 0
set myStepB to (item 4 of bounds of myPage) / 2
set oddPage to true
set secondHalf to false
set myCounter to 1
set PDF crop of PDF place preferences to crop media
repeat until myCounter = nPDFpages
log myPage
tell myDocument
if myCounter < secondHalfPDF then
if myCounter > 1 then
if not (exists (every page whose name is ((((name of myPage) as integer) + 1) as string))) then
set myPage to make page at after myPage
else
set myPage to (item 1 of (every page whose name is ((((name of myPage) as integer) + 1) as string)))
end if
end if
else if myCounter > secondHalfPDF then
set myPage to (item 1 of (every page whose name is ((((name of myPage) as integer) + 1) as string)))
end if
end tell
if my oddPage is true then
set myStep to myStepA
else
set myStep to myStepB
end if
if myMargin > 0 then
if ((name of myPage) as integer) mod 2 = 1 then -- 0 is even, 1 is odd
set myStep to myStep + myMargin
end if
end if
set page number of PDF place preferences to myCounter
get page number of PDF place preferences
tell myPage
set myPDFPage to place myPDF place point {myStep, 0}
set myPDFPage to item 1 of myPDFPage
end tell
set oddPage to my flipper(oddPage)
set myCounter to myCounter + 1
if myCounter = secondHalfPDF then
tell myDocument to set myPage to page "1"
set oddPage to my flipper(oddPage)
set secondHalf to true
end if
end repeat
end if
end tell
on flipper(bool)
if bool = true then
return false
else
return true
end if
end flipper