Enscript on Windows

Haven\’t used enscript ever but found it recently on the web and tried out some examples. Enscript is an ASCII to Postscript converter.

Examples [1]:

enscript -Plapis foo.txt
Print file foo.txt to printer lapis.

enscript -pfoo.ps foo.txt
Print file foo.txt, but leave PostScript output to file foo.ps.

enscript -Plapis -2 foo.txt
Print file foo.txt to two columns.

enscript -Plapis -2r foo.txt
Print file to two columns and rotate output 90 degrees (landscape).

enscript -Plapisd -DDuplex:true foo.txt
Print file in duplex (two side) mode (printer dependant).

enscript -E –color -Whtml –toc -pfoo.html *.h *.c
A nice HTML report of your project\’s C source files.

If no input files are given, enscript processes standard input. Enscript can be extended to handle different output media such as PostScript, HTML, RTF, ANSI, and overstrikes and it has many options which can be used to customize printouts. The GNU implementation of enscript is called genscript [2]. The example [1] using the -Whtml option did not work with my local enscript version though. But just make sure you get the most recent Windows binary [5].

[1] http://webinfo.ime.usp.br/util/enscript.html
[2] http://people.ssh.com/mtr/genscript/

Update: Scott Young [3] found a way to highlight PHP using enscript. Try \”enscript –help-pretty-print\” to get an idea what languages are supported in your version of enscript. Find other examples on linuxdevcenter.com [4]. You might also have a look at a2ps [6].

[3] http://scott.yang.id.au/2003/01/source-code-syntax-highlighting-in-php/
[4] http://www.linuxdevcenter.com/lpt/a/142
[5] http://gnuwin32.sourceforge.net/packages/enscript.htm
[6] http://www.inf.enst.fr/~demaille/a2ps

Leave a Reply