ARCHIVED: What is psduplex, and how can I use it to print on both sides of pages?
In Unix, the psduplex command makes a file
print out on both sides of the paper. At Indiana University, it is
available on Steel. It will work only with printers that
support double-sided (i.e., duplex) printing.
Note: On June 23, 2008, Steel will become read-only; you will be able to access your files there but not change them or add new files. Steel is replaced by IU's newest supercomputer, Quarry. For more, see ARCHIVED: About the Steel retirement.
The psduplex command accepts PostScript format
input, and should be the last filter used before the
print command.
A single switch, -tumble , causes files printed in
landscape mode to be rotated along the short side of the paper to keep
the text upright. Normally, the rotation is done along the long side
of the page.
For example, on a system using BSD-compatible printing, to
take the output of the enscript command converting a text
file named myfile.txt and print it double-sided on a
compatible printer named ps99, you would enter at the Unix prompt:
enscript -p- myfile.txt | psduplex | lpr -Pps99 -h
To print the same document in tumbled landscape mode, you would enter:
enscript -2rh -p- myfile.txt | psduplex -tumble | lpr -Pps99 -hBe sure that the printer you're using can handle double-sided printing
before you use psduplex.
Because psduplex is actually just an executable
Perl script, you can easily install it on your own system
by copying the text in between the lines into a file:
#!/usr/local/bin/perl -s # psduplex - insert PostScript code to set and unset duplexmode for this job # # usage: psduplex [-tumble], default "edge" # # Steve Kinzler, kinzler@cs.indiana.edu, October 1991 $_ = <>; unless (/^%!/) { # not PostScript, pass through as is print; while (<>) { print; } exit; } print; while (<>) { last unless /^\s*%/; print; } print "statusdict begin\n\ttrue setduplexmode\n"; print "\ttrue settumble\n" if $tumble; print "end\n"; print; while (<>) { print; } print "statusdict begin\n\tfalse setduplexmode\n"; print "\tfalse settumble\n" if $tumble; print "end\n";
Last modified on November 01, 2008.







