What's it called?
The current listing of printers can always be found in /etc/printcap
of whatever machine you're on.
As a general rule a printer that is
ps# (for # in 1..n) from the sparcs (i.e. sharks, orchard) or
any other cs machine (including moose)
will be cs_ps# from Silver (and, I assume, bronze).
What are Portrait and Landscape Modes? Why Care?
Note that most all of the CS department printers have 3 names:
- ps# for generic vertical orientation or portrait
mode -- think of a Rembrandt or Picasso portrait of someone sitting up
straight and TALL.
- ps#duplex for duplex portrait mode printing,
- ps#tumble for duplex horizontal orientation
or landscape mode -- here think of one of those bucolic French
landscapes painted on a big WIDE canvas that painters seemed to love.
Generally, the right thing to do if you're going to print in portrait
mode is to use ps#duplex and print to
ps#tumble when printing in landscape mode.
A Short List of Filters and Printing Programs that I know about and use
This is, once again, based only on my own experience (and the advice
of everyone who puts up with my annoying questions, of course).
Conventions
Commands will be listed in keyboard style (for browsers that
support it) and all printer output described below will be routed to the
the printer ps2, which is assumed to be a duplex printer
(explained below). Unless you really like ps2, you don't have to
route all your output there...
Files ending in .gz are files compressed using the gzip
utility (a newer compression program than compress) -- if you
use compress replace the .gz with .Z
Printer Queue Manipulation
COMMANDS
- lpq -Pps2
- lprm -Pps2 jobnumber
DESCRIPTION
These utilities allow you to examine the jobs in a printer's queue
(lpq) and the possibly remove a job from that queue
(lprm).
USAGE
lpq -Pps2 gives you a list of all jobs in the queue for ps2
their job numbers, and their owners and size.
lprm -Pps2 jobnumber removes the job with the given jobnumber from the queue, assuming that you own it.
COMMANDS
- lpr [switches] filename
- lpr [switches]
DESCRIPTION
The most basic of the basic printing utilities, lpr can be used by
itself or on the end of a pipe.
FILE TYPES
lpr takes text (straight ASCII) or PostScript without needing any
switches to be set. It can do .dvi files, but it is not recommended.
SWITCHES (or Command Line Options, for UNIX types...)
- -h
Don't print a header sheet. I recommend aliasing lpr
to lpr -h.
- -Pprinter
Send the output to the listed printer. See What's It
Called? to help figure out printer names (or just ask someone...)
- -d (NOT recommended)
Takes input from a TeX .dvi file. I've found that this tends to work
on a "when it feels like it" basis, and use other methods (described
below) to print out TeX .dvi files.
COMMON USAGE
COMMANDS
- enscript [switches] textfilename
- enscript [switches]
DESCRIPTION
enscript changes a text file to PostScript and then sends it off to
the printer. My most common use for it is to print text files two up, or
to turn a text file into PostScript so it can be manipulated with some
of the other filters -- psduplex and 2up spring to mind.
FILE TYPES
enscript takes text files and outputs PostScript.
SWITCHES (or Command Line Options, for UNIX types...)
- -h
Don't print a header page. This works only when outputting to a printer
since it's equivalent to lpr -h.
- -Pprinter
Same as with lpr
- -2
Print "2up", i.e. two pages, side by side, on each side of a piece of
paper. Usually combined with the -r option.
- -r
Rotate 90 degrees, to get "landscape" printing. Use with the
-2 option.
- -G
Gaudy. Print a gaudy header, with big page numbers and the file name.
Recommended.
- -l
Simulate a line printer -- 66 lines/page.
- -poutputfile
Write the PostScript file produced to the named file. If the filename
is "-", write to standard output. Useful when sending jobs through a
pipe.
COMMON USAGE
- To print a text file in 2-up and landscape modes and gaudy headers on the page and
without a header page:
enscript -Pps2 -2rGh filename.txt
- To print a compressed text file in the same way as the previous
example:
zcat filename.txt.gz | enscript -Pps2 -2rGh
- To print a text file in duplex mode to ps2:
enscript -2rG -p- filename.txt | lpr -Pps2duplex -h
- To print a compressed text file in 4 up mode (2 pages per output page) on
a duplex printer
zcat filename.txt.gz | enscript -hl -p- | 4up | lpr -Pps2 -h
COMMANDS
- psduplex
- psduplex -tumble
SPECIAL NOTE:
psduplex should be the LAST filter before lpr.
DESCRIPTION
psduplex is a filter which makes a file print out on both sides
of the paper (only on printers which support that, of course).
FILE TYPES
PostScript only. Note, however, that enscript outputs PostScript.
SWITCH/Command Line Option
- -tumble
Output is printed in landscape mode should be rotated along the short
side of the paper to keep the text upright. Normally, the paper is rotated
along the long side of the page to keep the text upright.
COMMON USAGE
-
To print a PostScript file with 2 pages on a physical side and then print
the file in 2 sided mode (i.e. print 4 pages of a file on 1 piece of paper):
2up filename.ps | psduplex -tumble | lpr -Pps2 -h
Note: alternatively, one can use:
2up filename.ps | lpr -Pps2tumble -h
- To print a text file with 4 pages on a piece of paper (2 pages on a
side) with gaudy headers and no header page:
enscript -2rGh -p- filename.txt | psduplex -tumble | lpr -Pps2 -h
Note: alternatively, one can use:
enscript -2rGh -p- filename.txt | lpr -Pps2tumble -h
- To print 8 pages of a text file on 1 piece of paper (4 pages on a side)
enscript -lh -p- filename.txt | 4up | lpr -Pps2duplex -h
COMMANDS
DESCRIPTION
2up takes a PostScript file (in filename or from stdin) and
causes it to be printed in landscaped mode, with two pages side-by-side
on a sheet of paper. Its output is similar to enscript.
FILE TYPES
PostScript
SWITCHES
None that I know of. 2up, as well as other ?up
filters, are shell scripts
provided in /usr/local/bin (on the SPARCs) that make use of
the general program up.
COMMON USAGE
COMMANDS
- 4up (this is in portrait mode)
- 8up
- 16up
DESCRIPTION
All these work just like 2up does, with the obvious change in
number of pages per sheet. 16up, for me, is impossible to read. 8up is workable, and 4up I find quite easy to
read. Remember that these work
only on PostScript, so if you want to print a text file 8 up (for
example) you have to run it through enscript first.
COMMANDS
- dvips [switches] filename.dvi
- dvips -f [other switches] < filename.dvi | (list of filters)
DESCRIPTION
dvips takes a dvi file produced by TeX or LaTeX and turns it into a
PostScript file, which it will try and print on the "standard" printer
(whatever that is) unless told otherwise.
FILE TYPES
Takes TeX- and LaTeX-produced .dvi files, and outputs PostScript.
SWITCHES/Command Line Options
- -o outputfile.ps
Send the output to the specified file instead of to the standard
printer.
- -f
Run as a filter. However, dvips cannot take input from a pipe, so the
input must be redirected from a file (see the common usage below).
Output goes out on stdout, and can be piped to wherever you want it.
- -p num
start from page "num" instead of from beginning
- -n num
at most "num" pages will be printed.
COMMON USAGE
- To produce filename.ps from filename.dvi:
dvips -o filename.ps filename.dvi
- To print the document in filename.dvi, 4 on a page:
dvips -f < filename.dvi | 2up | lpr -Pps2tumble -h
- To just print print pages 10 and 11 only:
dvips -f -p10 -n2 filename.dvi | lpr -Pps2duplex
COMMANDS
- psroff [switches] [file]
- ptroff [switches] [file]
- groff [switches] [file]
DESCRIPTION
These are troff to PostScript converters. Psroff
requires ditroff which
might not be available on all machines. Ptroff will always
work (although
the output might be uglier). Groff is a GNU substitution for
ditroff and is recommended.
SWITCHES/COMMAND LINE OPTIONS
psroff/ptroff
- -t
don't spool to the printer; send the generated PostScript code to the
standard output instead
- -Pprinter
spool to the printer "printer"
- -h
suppress the printing of the job burst page
- -mmacro
Use the macro package "macro". The most commonly used ones are "-ms"
and "-man".
groff
- -mmacro
same as psroff/ptroff---the macro package to use
- -e preprocess with eqn.
- -t preprocess with tbl.
- -p preprocess with pic.
- -s preprocess with soelim.
- -R preprocess with refer.
- -l Spool the output.
- -Tdev where "dev" can be:
- ps for PostScript printers and previewers (default)
- dvi for TeX dvi format
- X75 for a 75 dpi X11 previewer
- X75-12 same as X75 but use a larger font size
- X100 for a 100dpi X11 previewer
- X100-12 same as X100 but use a larger font size
COMMON USAGE
- To print a
ptroff -man -Pps2duplex nn.1
-
ptroff -ms -t foo.ms | 2up | lpr -Pps2duplex
-
psroff -me -t bar.me | ghostview -
(to preview it on X window)
-
groff -man tcsh.1 | 2up | lpr -Pps2duplex
-
groff -me -TX100 foo.me
(preview on X window)
-
groff -te -ms bar.ms | psrev -s5-6 | lpr -Pps2duplex
(preprocessed by tbl and eqn, then using macro set "ms" and pipe the
PostScript to psrev where we select printing only pages 5 and 6)
COMMANDS
- psrev -s pagespec
- dvips -p start -n num
DESCRIPTION
If for some reason you need to print only part of the document, you can
use dvips or psrev depending on the type of the document you want to print.
You can use dvips to selectively print part of a DVI file. Unfortunately
psrev requires that the PostScript file be an EPSF (Encapsulated
PostScript File). Fortunately most of the modern PS generating filters
(such as dvips, enscript, idraw, xfig, etc.) generate EPSF. So this
problem should fade away as time goes.
FILE TYPES
psrev takes PostScript files while dvips takes DVI files
SWITCHES/COMMAND LINE OPTIONS
psrev
-
-s pagespec
specifies a range (or several ranges) of pages to be printed.
Pagespec is a string, not containing spaces, of the form:
pagerange[,pagespec]
where pagerange may be
- a single page number, or
- a range of the form `N-M' which means print pages N through
M. -N means print from the beginning of the document to
page N. M- means print from page M to the end of the document.
dvips
- -p start
start from page "start" instead of from beginning
- -n num
print at most "num" pages starting from "start" as specified in -p
COMMON USAGE
- To select pages 1, 5, 6 and everything after page 10 from an
enscripted version of filename.txt and save the result
in the PostScript file foo.ps:
enscript -p- filename.txt | psrev -s1,5-6,10- > foo.ps
- To select 10, 11, 12, and 13, from a DVI file and save the result
in the PostScript file foo.ps:
dvips -p10 -n4 -f filename.dvi > foo.ps
- In either case, you should be able to preview the result by
ghostview to make sure you get the correct pages before you send
it off to the printer using:
ghostview foo.ps
REMEMBER that ps# from a cs machine is cs_ps# from a UCS machine.
Text Files:
- Print out a text file, 1 page/sheet, one-sided.
lpr -Pps2 -h filename.txt
- Print out a text file, 2 pages/sheet, one-sided, gaudy headers,
landscape mode.
enscript -Pps2 -2rGh filename.txt
OR
enscript -hl -p- filename.txt | 2up | lpr -Pps2 -h
- Print out a text file as in 1. but on both sides of the paper.
enscript -lh filename.txt | lpr -Pps2tumble -h
OR
enscript -hl -p- filename.txt | 2up | lpr -Pps2duplex -h
- Print out a text file as in 2. but on both sides of the paper,
with you owning the job but getting a header page.
enscript -2rG -p- filename.txt | lpr -Pps2duplex
- Print out as in 1. on both sides of the paper.
enscript -2rGh -Pps2duplex filename.txt
- Print out a text file on both sides of the paper, with 4 or 8 pages
per side of one sheet. This saves LOTS of paper.
enscript -hl -p- filename.txt | 4up | lpr -Pps2duplex -h
PostScript Files
- Print out a PS file, 1 page/sheet, one-sided
lpr -Pps2 -h filename.ps
- Print out a PS file, 2 pages/sheet, landscape, one-sided
2up filename.ps | lpr -Pps2 -h
- Print out a compressed PS file as in 1.
zcat filename.ps.gz | lpr -Pps2 -h
- Print out a compressed PS file as in 2.
zcat filename.ps.gz | 2up | lpr -Pps2 -h
- Print a PS file as in 1. but double-sided.
cat filename.ps | lpr -Pps2duplex -h
- Print a PS file as in 2. but double-sided
2up filename.ps | lpr -Pps2duplex -h
REMEMBER: you can substitute 4up or 8up for
2up in any of these examples.
DVI Files
- Produce a PS file from a dvi file
dvips -o outfilename.ps filename.dvi
- Print a dvi file single sided, one page/sheet.
dvips -f < filename.dvi | lpr -Pps2 -h
- As in 2. but double-sided:
dvips -f < filename.dvi | lpr -Pps2duplex -h
- As in 2. but two pages/sheet.
dvips -f < filename.dvi | 2up | lpr -Pps2 -h
(or use 4up or 8up if you want).
- As in 3. but two pages / sheet.
dvips -f < filename.dvi | 2up | lpr -Pps2duplex -h
(or use 4up or 8up)
Acknowledgements
Created by wdueber on October 30, 1992.
Last updated by shei on November 3, 1992.
HTML and minor updates by tloos on May 17, 1995.