S/370 printing to PDF

S/370 printing

Wouldn’t we all like to have our S/370 output out of Hercules look like this?

How do we do that?

There’s quite a bit of tinkering involved. I will do my best to describe how I did it below and on a few other pages.

Common Hercules stuff

First, there’s some common stuff we have to do on the Hercules level. These pages have been written working on Rasperry Pi’s with Raspbian Lite Linux, So YMMV…

Let’s start

Output from the S/370 systems comes out in *.txt files. When we want it to look like the picture above we have to do some tinkering of our own.

This article is a recipe for PDF output from .txt spool files out of Hercules and I tested it on Linux on my Raspberry Pi. First, as always, we make sure the system is up to date:

sudo apt-get update
sudo apt-get upgrade

Programs involved

Next we look wether ‘enscript‘ and ‘ps2pdf‘ are installed:

which enscript
which ps2pdf

If they are, we’re golden! If not:

sudo apt-get install enscript
sudo apt-get install ghostscript

Ghostscript? Yes, ghostscript, because ps2pdf is part of that package.

How to use these programs?

Now the seperate commands to create .pdf files are, assuming that you input file is prt00f.txt:

enscript --font=Courier-Bold@8 -l -H1 -r --margins=25:25:40:40 -p prt00f.ps prt00f.txt

We now have a postscript file containing our output. The next step is to convert it to .pdf:

ps2pdf prt00f.ps prt00f.pdf

This program, as the name implies, simply takes a Postscript file and converts it to .pdf on gray-striped paper. The -H1 parameter indicates the height of the individual stripes in number of lines. I made mine one line high.


As you might have seen, it is also possible to give the stripes a bit of color. In my case, I made them light green, born out of my nostalgia… The color of the striped lines is governed by a file called enscript.pro. This file can be found in directory /usr/share/enscript. Have a look at the image below, there’s a section indicated by the text ‘Highlight bars.’ in which you can code an RGB color, in my case I used:

0.9 1 0.9 setrgbcolor

This makes for a nice light green color.

Combine them into one command

Now both enscript and ps2pdf can write to and read from stdout and stdin, just substitute the name of your file with a minus sign. This is convenient because now we can pipe them together, so we don’t get polution in our directory of those .ps files that we don’t need anyway:

enscript --font=Courier-Bold@8 -l -H1 -r --margins=25:25:40:40 -p - prt00f.txt | ps2pdf - prt00f.pdf

Now for the different stuff per OS

Click on one of these links to continue for your OS of choice: