Transforms the input PDF into one which is printable as a booklet
- Python 100%
| doc | Added booklet image | |
| .gitignore | Converted the codebase to Python3 | |
| blank.pdf | append blank pages, write output file | |
| bookfold.py | Converted the codebase to Python3 | |
| README.md | Added Algo to README.md | |
| requirements.txt | Converted the codebase to Python3 | |
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.