Enscript is an old utility, originally from Adobe, now by GNU, that typesets
plaintext into postscript. Has a number of handy options for printing code.
- enscript -p enscriptoutut.ps enscript-test.txt
- Print to a PostScript file so that you can test options without killing trees.
- enscript --word-wrap -f Times-Roman10 -p enscriptoutut.ps enscript-test.txt
- Good for regular prose printing. Doesn't leave much of a margin for notes and
there is no double spacing so this won't make it very comfortable for editing.
- enscript --word-wrap -f Times-Roman10 -s 16 --margins=72:72:30:30 -p out.ps foo.txt
- Good for hand-editing code. Generous margins (measured in points, 72 to
an inch), double spacing (-s 16), also measured in points so here it's a
value that's a bit more than the font size (10).
- enscript -p enscriptoutut.ps -G2E -f Courier5 foo.c
- My default code printing command. Big header, two columns, tiny font
so that two columns fit in normal (i.e. non-landscape) orientation.
- enscript -G2rE -U2 foo.c
- Another code printing recipie: gaudy header, two columns, landscape,
code highlighting, 2-up printing.
- -s num, --baselineskip=num
- Use this to get double (or triple) spacing. The value of num should be
something on the order of a multiple of the font size. For example, if
you're using 10 point font, specify a value of 14 to get double spacing.
A value of 16 will give you a little more room to actually do some
handwriting between the lines.
- -T num, --tabsize=num
- The default tabsize is 8 so when you're printing code you probably want to
pick something smaller.
- -U num, --nup=num
- Print num logical pages on each output page. (N-up printing)
- Adjust page marginals to be exact left, right, top and bottom PostScript
points. Any of arguments can be left empty in which case the default value is
used. There are 72 points per inch.
- If you're printing text you definitely want this option. Hell, even if
you're printing code you probably want it. Without it, enscript will wrap
right in the middle of words.
- -p file, --output=file
- Leave output to file file. If file is `-', leave output to stdout.
- -P name, --printer=name
- Spool output to the printer name.
- Gaudy headers. Big page number, filename, time/date stamp
- Landscape mode
- Pretty print. If priting code, may give you syntax coloring.
- Two-column printing.
- -f name, --font=name
- Specify the font. On a Mac you can see the list of fonts:
cat /usr/share/enscript/font.map but what's available will be system
dependent. Stable choices that should be available just about anywhere:
Times-Roman12 Courier10. On my Leopard-running MacBookPro, I like