PSTOPS(1)

NAME
pstops

SYNOPSIS
pstops [OPTION...] [INFILE [OUTFILE]]

DESCRIPTION
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).

INFILE
    `-' or no INFILE argument means standard input

OUTFILE
    `-' or no OUTFILE argument means standard output

OPTIONS

-S SPECS, --specs SPECS
    page specifications (see below)

-R PAGERANGE, --pages PAGERANGE
    select the given page ranges

-e, --even
    select even-numbered output pages

-o, --odd
    select odd-numbered output pages

-r, --reverse
    reverse the order of the output pages

-p PAPER, --paper PAPER
    output paper name or dimensions (WIDTHxHEIGHT)

-P INPAPER, --inpaper INPAPER
    input paper name or dimensions (WIDTHxHEIGHT)

-d [DIMENSION], --draw [DIMENSION]
    draw a line of given width (relative to original page) around each page [argument defaults to 1pt; default is no line; width is fixed for PDF]

-v, --version
    show program's version number and exit

-q, --quiet
    don't show progress

COMMENTS
PAGES is a comma-separated list of pages and page ranges. SPECS is a list of page specifications [default is "0", which selects each page in 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.