PSTOPS

Section: User Commands (1)
Updated: April 2021
Page Index
 

NAME

pstops - rearrange pages of a PostScript document  

SYNOPSIS

pstops [,OPTION/...] [,INFILE /[,OUTFILE/]]  

DESCRIPTION

Rearrange pages of a PostScript document.

The input PostScript file 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).

-S, --specs=,SPECS/
page specifications (see below)
-R, --pages=,PAGES/
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/
output paper name or dimensions (WIDTHxHEIGHT)
-P, --inpaper=,PAPER/
input paper name or dimensions (WIDTHxHEIGHT)
-d, --draw[=,DIMENSION/]
draw a line of given width (relative to original page) around each page [argument defaults to 1; default is 0]
-b, --nobind
disable PostScript bind operators in prolog; may be needed for complex page rearrangements
-q, --quiet
don't show page numbers being output
--help
display this help and exit
--version
display version information and exit

PAGES is a comma-separated list of pages and page ranges.

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.

PAGESPECS 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[turns][@scale][(xoff,yoff)]
turns
= turn[turns]
turn
= 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 paper width or height.

The optional parameters L, R, U, H, and V rotate the page left, right, or upside-down, and flip (mirror) the page horizontally or vertically respectively. The optional scale parameter scales the page by the fraction 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 paper size, if set, is used (after scaling) to set the clipping path for each page.  

Exit status:

0
if OK,
1
if arguments or options are incorrect, or there is some other problem starting up,
2
if there is some problem during processing, typically an error reading or writing an input or output file.
 

EXAMPLES

To put two pages on one sheet of A4 paper, the pagespec to use is:

2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm)

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(21cm,0)+0L@.7(21cm,14.85cm)

for the front sides, and

4:1L@.7(21cm,0)+-2L@.7(21cm,14.85cm)

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

AUTHOR

Written by Angus J. C. Duggan and Reuben Thomas.  

BUGS

Pstops does not accept all DSC comments.  

COPYRIGHT

Copyright © Reuben Thomas 2017-2020. Released under the GPL version 3, or (at your option) any later version.  

TRADEMARKS

PostScript is a trademark of Adobe Systems Incorporated.  

SEE ALSO

psutils(1), paper(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
Exit status:
EXAMPLES
AUTHOR
BUGS
COPYRIGHT
TRADEMARKS
SEE ALSO