[Tex/LaTex] How to sort the order of pages so that they can be printed in a folded book

contextprinting

I am using ConTeXt to print a book. Each page is A5, but the print store can only print on A4 paper, so they print 2 pages on each side of the A4 paper. I used this code to specify the layout:

\setuppagenumbering[location=bottom, alternative=doublesided]
\setuppapersize[A5]

The print store does not know how to properly sort these A5 pages for printing. They requested I give them a PDF set for A4 paper, already sorted properly. If there are 100 pages, then the first piece of paper would look like this:

(front of 1st paper)
 ________ ________
|        |        |
|        |        |
|        |        |
|__100___|____1___|

(back of 1st paper)

 ________ ________
|        |        |
|        |        |
|        |        |
|____2___|___99___|

The second piece of paper would look like this:

(front of 2nd paper)
 ________ ________
|        |        |
|        |        |
|        |        |
|___98___|____3___|

(back of 2nd paper)
 ________ ________
|        |        |
|        |        |
|        |        |
|____4___|___97___|

The pages are then assembled like this:

      /|=====>>/|=====>>/|
100->/ |  98->/ |  96->/ |
    /  |     /  |     /  |
   / 99|    / 97|    / 95|
   |\  |    |\  |    |\  |
   | \ |    | \ |    | \ |
   |  \     |  \     |   |
   |   |    |   |    |   |
   | 1 |    | 3 |    | 5 |
    \  |     \  |     \  |
     \ |<-2   \ |<-4   \ |<-6
      \|=====>>\|=====>>\|

I have tried internal options in ConTeXt and pdfbook, but I cannot see any options which sorts the pages in this way.

Best Answer

It is probably easier to post-process the PDF. TeXLive contains a tool called pdfbook that does this:

pdfbook --batch example.pdf

will create a example-book.pdf with the pages resorted and 2-on-1. In case you create postscript output, there is also a psbook.

Edit: Maybe your pdfbook is too old? Mine produces a perfect Booklet-PDF with out any extra parameters.