I often find myself wanting to print some small article or manual for reading. But I like to save paper: print everything in two sides and fit multiple pages per side. One way to do that is printing everything in order, but the better way is to order the pages so you can fold the printed leaves and make a small nice-looking booklet.
But how do you do that? Myself, I have this small script that handles the work, based on popular unix pstools. Here is it:
#!/bin/bash ## Script for printing booklets. just call with your pdf file as argument, and it generates c1.ps and c2.ps. ## First send c1.ps to printer, then move the pages back to the input tray, and send c2.ps. ## by Nicolau <firstname.lastname@example.org> pdftops -expand -paper A4 $1 /tmp/book.ps psbook < /tmp/book.ps | psnup -2 | psselect -er > c1.ps psbook < /tmp/book.ps | psnup -2 | psselect -o > c2.ps
First of all the script converts the input file (assumed to be a pdf!) to postscript, and saves the result in /tmp. I’ve been needing to use this -expand option lately, otherwise the pages get reduced in some situations for some reason. After that we use the formidable psbook program to rearrange the pages for booklet printing. This is the program that does the most complicated work.
To actually print the output of psbook we need to call psnup to fit the pages into the leaves, and then select first the even pages then the odd pages for printing in the front and back side of the paper. In printers that can make two-sided printing automatically you only need to send the output of psnup directly… But in most non-advanced printers you need to print this first file, then move the paper to the input tray (preserving the “upwards” orientation of the pages) then send the next file. In my printer I do this and then I can pick up the output and immediately fold and bind. Beware that some printers might mess with the orientation and page order, so you have to check out how things are in your network.
Have a nice reading! 🙂