CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit for current CERN information.

next up previous
Next: xpick---Pick images on Up: PostScript tools Previous: psselect---select pages from

pstops---shuffle pages in a PostScript file

pstops  [ -q ] [ -b ] [ -w\Larg{width} ] 
        [ -h\Larg{height} ] [ -p\Larg{paper} ]
        [ -d\Larg{lwidth} ] pagespecs
        [ infile [ outfile ] ]

The program pstops, written by Angus Duggan, rearranges pages from a PostScript document, creating a new PostScript file. The input PostScript file should follow the Adobe Document Structuring Conventions. The program can be used to perform a large number of arbitrary re-arrangements of documents, including arranging for printing 2-up, 4-up, booklets, reversing, selecting front or back sides of documents, scaling, etc.

The parameter pagespecs allow you to specify which pages are to be treated. The following syntax has to be used:

pagespecs = [modulo:]specs

specs = spec[+specs][,specs]

spec  = [-]pageno[L][R][U][@scale][(xoff,yoff)]

The number of pages in each block; must be >0 (default is 1).
The page specifications for the pages in each block. The value of pageno in each spec should be (first page in block) and modulo-1 (last page in block). The optional dimensions xoff and yoff shift the page by the specified amount. These dimensions are by default given in PostScript points, but may also be specified in cm or in by following them with the string cm, or in, respectively. Alternatively, you can specify the flag w or h, meaning that you are using multiples of the width or height. The optional parameters L, R, and U rotate the page left, right, or upside-down. The optional parameter scale will scale the page by the specified fraction. If the optional minus sign is specified, the page is relative to the end of the document, instead of the start.

If page specs are separated by + the pages will be merged into one page; if they are separated by a space, they will be on separate pages. If there is only one page specification, with pageno=0, then pageno may be omitted.

The shift, rotation, and scaling are performed in that order regardless of which order they appear on the command line.

Overview of the options

Prevents bind operators in the PostScript prolog from binding. This may be needed in cases where complex multi-page re-arrangements are being made.
Draws a line around the border of each page, of the specified width. If the lwidth parameter is omitted, a default linewidth of 1 pt is assumed. The linewidth is relative to the original page dimensions, i.e. it is scaled up or down with the rest of the page.
The height used by the h dimension specifier.
Alternative to set the paper size to a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto or 10x14 (default paper size is a4).
Suppress printing the page numbers of the pages being rearranged (default all page numbers are printed).
The width used by the w dimension specifier.
The h and w dimensions are used (after scaling) to set the clipping path for each page.


If you want to put two pages on one sheet (of A4 paper), the pagespec to use is:

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

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

for the front sides, and

for the reverse sides (or join them with a comma for duplex printing).

pstops '4:0@.5(0,14.5cm)+1@.5(10.5cm,14.5cm)'\

This will print on one A4 page four A4 pages reduced by a factor of two.

next up previous
Next: xpick---Pick images on Up: PostScript tools Previous: psselect---select pages from

Janne Saarela
Tue May 16 13:43:26 METDST 1995