enscript with greenbar output

The following commands are taken from a link Professor Rene’ Ferland’s pointed to on his website.

enscript –font=Courier-Bold@8 -l -H3 -r –margins=25:25:40:40 -p cobol01.ps cobol01.cob

ps2pdf cobol01.ps cobol01.pdf

The professor’s script used Ghostscript rather than ps2pdf.

The above 2 commands can be combined into one.

enscript –font=Courier-Bold@8 -l -H3 -r –margins=25:25:40:40 -p – cobol01.cob | ps2pdf – cobol01.pdf

For my use I used Python to execute the commands because I am more familiar with Python and found it easier and more straight forward to do what I wanted, that someone with more Bash experience probably could do. Specifically I wanted to do some string manipulation and it seemed like Bash would frequently use yet another utility to do the work to accomplish what I could easier in Python.


To get the colored bars you need to modify the “rgb setrgbcolor” line in the Highlight bars section in enscript’s enscript.pro file in it’s installed directory. In my case it’s in /usr/bin/enscript/.

A Comparison…

Enscript program
My program

Well my programs also has the holes. However being that enscript is a easily installed Linux program, I wouldn’t have gone through the trouble of writing my program if I was aware of this. The enscript method certainly conveys the mainframe feel. I believe the shade of green difference came from me scanning one of my old listings, then using the eyedropper in gimp to detect the color. One thing I especially like about my program is my easily added command line switch that will print bluebar instead of greenbar.