/Rearrange pages of a PDF or PostScript document/ PostScript files should follow the Adobe Document Structuring Conventions.

Pstops can be used to perform arbitrary re-arrangements of documents. For many tasks, it is simpler to use the other utilities in the PSUtils suite: see psutils(1). /comma-separated list of pages/ Each may be a page number, or a page range of the form first-last. If first is omitted, the first page is assumed, and if last is omitted, the last page is assumed. The prefix character ‘_’ indicates that the page number is relative to the end of the document, counting backwards. If just this character with no page number is used, a blank page will be inserted. Page numbers refer to the pages as they occur in the file, starting at one. The actual page number in the document may be different. /its normal order/

Pagespecs have the following syntax:

    pagespecs
        = [modulo:]specs

    specs
        = spec[+specs|,specs]

    spec
        = [-]pageno[transform...][@scale][(xoff,yoff)]

    transform
        = L|R|U|H|V

modulo is the number of pages in each block. The value of modulo should be greater than 0; the default value is 1.

specs are the page specifications for the pages in each block. The value of the pageno in each spec should be between 0 (for the first page in the block) and modulo-1 (for the last page in each block) inclusive. If there is only one page specification, the pageno (0) may be omitted.

The optional dimensions xoff and yoff shift the page by the specified amount. xoff and yoff may either be lengths (see psutils(1)) or followed by w or h to indicate a multiple of the output page width or height.

The optional transformations L, R, U, H, and V rotate the page left, right, or upside-down around its lower left corner, and flip (mirror) the page horizontally or vertically respectively. The optional scale parameter scales the page by the factor specified. If the optional minus sign is specified, the page number is relative to the end of the document, instead of the start.

Pages whose specs are separated by + will be merged into a single page; otherwise, they will remain as separate pages.

The shift, rotation, and scaling are applied to the PostScript transformation matrix in that order, regardless of the order in which they appear on the command line.

Paper size names are converted to dimensions using paper(1). The output page size, if set, is used (after scaling) to set the clipping path for each page. [EXAMPLES] To put two A or B series pages (e.g. A4 or B5) on one sheet of paper, the pagespec to use is:

2:0L@.7(1w,0)+1L@.7(1w,0.5h)

To select all of the odd pages in reverse order, use:

2:-0

To re-arrange pages for printing 2-up booklets, use

4:-3L@.7(1w,0h)+0L@.7(1w,0.5h)

for the front sides, and

4:1L@.7(1w,0h)+-2L@.7(1w,0.5h)

for the reverse sides, or, for long-edge duplex printing, join the two specs thus:

4:-3L@.7(1w,0h)+0L@.7(1w,0.5h),1L@.7(1w,0h)+-2L@.7(1w,0.5h)

For short-edge duplex, the incantation is:

4:-3L@.7(1w,0h)+0L@.7(1w,0.5h),1R@.7(0w,0.5h)+-2R@.7(0w,1h)

[>AUTHOR]

BUGS
pstops does not accept all DSC comments.