pdf2page

A small shell script to convert singlepage A4-sized pdf documents to two pages per sheet using pstools.

#!/bin/bash
function switch() {
    rm -f pdfopt.ps
    mv pdfopt2.ps pdfopt.ps
}
pdftops -paper A4 -level3 $1 pdfopt.ps
psresize -p a4 pdfopt.ps pdfopt2.ps ; switch
psnup -n2 -d1 -pa4 -Pa4 pdfopt.ps pdfopt2.ps ; switch
psresize -pa4 pdfopt.ps pdfopt2.ps ; switch
psresize -Pa4 pdfopt.ps pdfopt2.ps ; switch
ps2ps pdfopt.ps pdfopt2.ps ; switch
ps2pdf pdfopt.ps `basename $1 .pdf`_2.pdf
rm -f pdfopt.ps