1
0
Fork
You've already forked bookfold
0
Transforms the input PDF into one which is printable as a booklet
  • Python 100%
Find a file
2026年06月08日 18:55:01 +01:00
doc Added booklet image 2016年08月11日 09:51:55 +03:00
.gitignore Converted the codebase to Python3 2016年08月12日 00:58:35 +03:00
blank.pdf append blank pages, write output file 2010年08月20日 03:33:19 +03:00
bookfold.py Converted the codebase to Python3 2016年08月12日 00:58:35 +03:00
README.md Added Algo to README.md 2026年06月08日 18:55:01 +01:00
requirements.txt Converted the codebase to Python3 2016年08月12日 00:58:35 +03:00

Bookfold

Transforms the input PDF into one which is printable as a booklet.
Algorithm described here http://blogs.gnome.org/cneumair/2007/03/15/printing-instruction-manuals-how-to-reorder-postscript-files/

Algorithm

The script first copies the input PDF and pads it with blank pages until the page count is a multiple of four, which is required for folded booklet sheets. It then reorders pages from the outside in: for each sheet it pairs the last remaining page with the first remaining page, alternating the pair order on front and back sides. For an 8-page document this produces:

8, 1, 2, 7, 6, 3, 4, 5

When printed two pages per side with duplex printing, the pages fold back into normal reading order.

Booklet printing