'\"macro stdmacro
.if n .pH g1.postreverse @(#)postreverse	40.2 of 12/20/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} postreverse 1 "Line Printer Spooling Utilities" "\&"
.if \nX=1 .ds x} postreverse 1 "Line Printer Spooling Utilities"
.if \nX=2 .ds x} postreverse 1 "" "\&"
.if \nX=3 .ds x} postreverse "" "" "\&"
.TH \*(x}
.SH NAME
\f4postreverse\fP \- reverse the page order in a PostScript file
.SH SYNOPSIS
\f4postreverse \fP[\f2options\fP] [\f2file\fP]
.SH DESCRIPTION
The \f4postreverse\fP filter
reverses the page order in files that conform to Adobe's
Version 1.0 or Version 2.0 file structuring conventions,
and writes the results on the standard output.
Only one input
.I file
is allowed and if no
.I file
is specified, the standard input is read.
The following
.I options
are understood:
.TP 1.0i
\f4-o \f2list\f1
Select pages whose numbers are given in the comma-separated
.IR list .
The \f2list\fP contains single numbers
.I N
and ranges
\f2N1 \fP\- \f2N2\fP.
A missing
.I N1
means the lowest numbered page, a missing
.I N2
means the highest.
.TP 1.0i
\f4-r\fP
Don't reverse the pages in
.IR file .
.PP
The \f4postreverse\fP filter
can handle a limited class of files
that violate page independence,
provided all global definitions are bracketed by
\&\f4%%BeginGlobal\fP and \&\f4%%EndGlobal\fP comments.
In addition, files that mark the end of each page
with \&\f4%%EndPage: label ordinal\fP comments
will also reverse properly, provided the prologue and
trailer sections can be located.
If \f4postreverse\fP
fails to find an \&\f4%%EndProlog\fP or \&\f4%%EndSetup\fP comment,
the entire
.I file
is copied, unmodified, to the standard output.
.PP
Because global definitions are extracted from individual
pages and put in the prologue, the output file can be
minimally conforming, even if the input
.I file
wasn't.
.SH EXAMPLES
To select pages 1 to 100 from \f2file\fP and reverse the pages:
.PP
.RS
\f4postreverse -o1-100 \f2file\f1
.RE
.PP
To print four logical pages on each physical page
and reverse all the pages:
.PP
.RS
\f4postprint -n4 \f2file\fP | postreverse\f1
.RE
.PP
To produce a minimally conforming file from output
generated by \f4dpost\fP without reversing the pages:
.PP
.RS
\f4dpost \f2file\fP | postreverse -r\f1
.RE
.PP
.SH DIAGNOSTICS
An exit status of 0 is returned if
.I file
was successfully processed.
.SH NOTES
No attempt has been made to deal with redefinitions of global
variables or procedures.
If standard input is used, the input
.I file
will be read three times before being reversed.
.SH SEE ALSO
\f4download\fP(1),
\f4dpost\fP(1),
\f4postdaisy\fP(1),
\f4postdmd\fP(1),
\f4postio\fP(1),
\f4postmd\fP(1),
\f4postprint\fP(1),
\f4posttek\fP(1).
