The script works as expected unless the user chooses facing pages as an option. If facing pages is chosen, after page one, all subsequent pages are placed on the even (left hand) pages of the document. And the spread’s odd page is also placed on the page’s even page, e.g. PDF page 2 is correctly placed on page 2 of the InDesign doc, then PDF page 3 is placed on top of PDF page 2 on page 2 of the InDesign doc. And page 3 of the InDesign doc is left blank. It continues in the fashion throughout. So page 1 gets a PDF place on it but all the rest of the odd pages are blank. And all the even pages have two PDFs placed on them, one on top of the other.
The script specifically iterates through the pages telling each page to create a frame and place the corresponding PDF page in that frame. So I can’t figure out why it’s placing the odd pages on the facing even page.
Here’s the part of my script that actually handles creating the frames and placing the PDFs.
--finally we'll place all the pages in the document
else
if withBleed then
set PDF crop of PDF place preferences to crop bleed
else
set PDF crop of PDF place preferences to crop trim
end if
repeat pdfPageCount times
set page number of PDF place preferences to pageCounter
get page number of PDF place preferences
tell page currentPage of myDoc
if withBleed then
set bleedBounds to {-0.125, -0.125, (docHeight + 0.125), (docWidth + 0.125)}
set pdfframe to make rectangle with properties {geometric bounds:bleedBounds}
set placedPDF to place workingFile on pdfframe
set placedPDF to item 1 of placedPDF
else
set pageBounds to {0, 0, docHeight, docWidth}
set pdfframe to make rectangle with properties {geometric bounds:pageBounds}
set placedPDF to place workingFile on pdfframe
set placedPDF to item 1 of placedPDF
end if
--scale and center pdf if scaling was chosen
tell placedPDF
set horizontal scale of it to scaleTo
set vertical scale of it to scaleTo
end tell
fit placedPDF given center content
end tell
set pageCounter to pageCounter + 1
set currentPage to currentPage + 1
end repeat
end if
I’m happy to post the entire script if that will help someone figure out where the problem lies. It’s a pretty large script though (over 100K) so I didn’t want to post it all here if it’s not necessary.