Skip to content

Instantly share code, notes, and snippets.

@UnrulyJuli3
UnrulyJuli3 / booklet.js
Last active July 2, 2024 03:19
Calculate booklet page printing order
// Pass in the number of pages in your document, e.g. 8
// The output is an array describing how to layout the pages for a booklet
// e.g. [8, 1, 2, 7, 6, 3, 4, 5]
// This means the front of your first sheet of paper
// should have pages 8 and 1 of your document side-by-side,
// then the back should have pages 2 and 7, then the front
// of your second sheet should have pages 6 and 3, etc.