A pocketmod is a 8-page booklet obtained by folding a single sheet. How? This video shows how to do it. Here is a simple script to convert an 8-page pdf document into a pocketmod-foldable sheet, it is a modified version of a script by Rick Holbert.


# pdf2pocketmod - script to generate 1-page pocketmod from 8-page pdf.
# Little Neo, 2011

# very very very inspired by Rick Holbert
# http://weblog.bignerdranch.com/?p=23 (see comments)

# The script works with A4 paper. If you want to use US letter paper, replace the word a4paper with letterpaper.

# use: ./pdf2tinybk foo.pdf
# will generate foo_pocketmod.pdf

# Enjoy!

pdflatex=$(whereis pdflatex|cut -d' ' -f 2)

outfile="$(basename $infile .pdf)_pocketmod.pdf"


mkdir "$tmpdir"
cp "$infile" "$tmpdir/in.pdf"
cd "$tmpdir"

# invert pages which need to be inverted

$pdflatex \\batchmode \
\includepdf[pages=1, angle=180]{in.pdf}\
\includepdf[pages=6-8, angle=180]{in.pdf}\

mv book.pdf in.pdf

# compose pages into 1-page pocketmode mosaic

$pdflatex \\batchmode \
pdfproducer = {pdf2pocketmod}\
\includepdf[nup=4x2, pages={2-5,1,8-6}, trim=0mm 0mm 0mm 0mm, cut, frame]{in.pdf}\

mv book.pdf "$OLDPWD/$outfile"

rm -rf "$tmpdir"

Application : the one hundred push ups program.

Little Neo, January 2011