% Run this file with pdftex, it produces a file named % booklet.pdf in the current directory. Alfred Klomp, 2006. \def\bookletfile{/home/alfred/mydocument.pdf} \newcount\numpages \newcount\halfnumpages \newcount\fcount % forwards count, starts at page 1 and counts up \newcount\bcount % backwards count, starts at last page and counts down \newcount\leftright % is the page with the lowest number on the left? \newcount\pagea % pageno. to be placed on the left \newcount\pageb % pageno. to be placed on the right \pdfpagewidth 297mm % landscape A4 format \pdfpageheight 210mm \pdfximage {\bookletfile} \numpages=\pdflastximagepages \halfnumpages=\numpages \divide\halfnumpages by 2 \fcount=1 \bcount=\numpages \leftright=0 \pdfhorigin=0bp \pdfvorigin=0bp \loop \ifnum\leftright=0 \pagea=\bcount \pageb=\fcount \leftright=1 \else \pagea=\fcount \pageb=\bcount \leftright=0 \fi \shipout\hbox to \pdfpagewidth {% \pdfximage height \pdfpageheight page \pagea {\bookletfile}% \pdfrefximage\pdflastximage% \hfil% \pdfximage height \pdfpageheight page \pageb {\bookletfile}% \pdfrefximage\pdflastximage% } \advance\fcount by 1 \advance\bcount by -1 \ifnum\bcount>\halfnumpages\repeat \end