Convert pages to saddle-stitch-ready spreads in Adobe InDesign

Or: how to Print booklet… to PDF in Adobe InDesign.

The File > Print Booklet… system in Adobe InDesign is slick, but (as of CC 2017) it can’t directly print the resulting booklet to PDF. The “workaround” is to print to a PostScript file, then run it through Distiller. This is fine if you have Distiller, but even so, not terribly convenient.

This page gives an AppleScript that will reorder your pages in InDesign so they’re suitable for printing saddle-stitch-ready spreads to PDF.

Table of contents:

What is the goal?

Simply put, the idea is to take a bunch of pages that are in their ‘natural’ order, and reorder them so that the spreads are suitable for saddle-stitch printing.

Before the script:

InDesign Pages window showing typical facing pages

After the script:

InDesign Pages window showing bookletized spreads

The large page numbers in the centre are the original page numbers (which I typed in for this demo).

The pages needn’t necessarily be facing. Here is an example with 8 non-facing pages:

Before the script:

InDesign Pages window showing typical non-facing pages

After the script:

InDesign Pages window showing bookletized spreads

You must have a multiple of 4 pages to use this script (since that is required for 2-up saddle-stitch).

The script

Here is the script, ready to paste into the AppleScript Script Editor. You may need to adjust the first line to reflect the name of the InDesign version you’re using.

This has only been tested with InDesign CC 2017.

tell application "Adobe InDesign CC 2017"
	tell active document
		-- Grab a list of the current pages and their IDs
		set pageList to {}
		repeat with thePage in (get pages)
			set end of pageList to id of thePage
		end repeat
		-- Check page count sanity
		set pageCount to the length of pageList
		if pageCount mod 4 ≠ 0 then
			display dialog "The number of pages must be a multiple of 4."
			return
		end if
		-- Allow pages to roam free
		tell document preferences
			set allow page shuffle to false
		end tell
		-- Check for a silly corner case (do you really need a script to move a page or two? ;-)
		if pageCount = 4 then
			move the last page to before page 1 binding left align
			-- Only necessary if using non-facing pages, but does no harm if facing already
			move the last page to after page 3 binding right align
			return
		end if
		-- Move odd pages
		set targetPage to 4
		set pageIncr to 4
		repeat with srcPage from 3 to (pageCount - 1) by 2
			move page id (item srcPage of pageList) to after page id (item targetPage of pageList) binding right align
			-- In this way, targetPage will be (eg for 12 pages)
			-- 4, 8, 10, 6, 2
			set targetPage to targetPage + pageIncr
			if targetPage = pageCount then
				set targetPage to pageCount - 2
				set pageIncr to -4
			end if
		end repeat
		-- Move even pages (slightly easier now)
		set targetPage to pageCount - 3
		set pageIncr to -2
		repeat with srcPage from 4 to pageCount by 2
			move page id (item srcPage of pageList) to before page id (item targetPage of pageList) binding left align
			-- This is rather simpler (eg for 12 pages)
			-- 9, 7, 5, 3, 1
			set targetPage to targetPage + pageIncr
		end repeat
	end tell
end tell
return

TODO: Add Script Editor colours. :-)


Questions, comments, jokes? Email me:

Questions, commentaires, blagues? Écrivez-moi :