Printing a Banner on a Dot Matrix Printer from Linux with Python


My first banner! Took 3 minutes to print using 'Utility' Print Quality..

After getting my dot matrix pritner runing on CentOS 8, I started generating classic dot matrix prints. I printed a name tag for my work cubical using the linux 'banner' command and piping the output to lpr. Althrough the banner command works great for creating something a page width, I could not find a solution to make those classic dot matrix LARGE banners. On YouTube, I found lots of examples of people making banners, but they all used 80s computers and software.

Disappointed in not finding a way to print the banner, I started exploring if I could use python. I researched some of the python graphic packages, but eventually decided to make my own solution. I could simply use print statetements to create the latters, and then pipe the output of the script to LPR. I defined a function for each letter, and then a function for each word (which simply calls each letter function),

Here is the 'H' function that will draw the letter h:

The width of the paper is 80 characters, so I figured a 10 space buffer at the bottom of the page, and a 10 character buffer at the top, so the letters could be 60 characters high.

It was time consuming to craft each letter out of ascii characters, but then I watched CuriousMarc's YouTube video on an IBM 1401 running the 'Edith' program. Somebody in the 1960s created 300 punch cards to draw ascii art of a women named Edith on the 1401's printer... that is crazy.

UPDATE February 2nd, 2021: Found an interesting article How to create a quick ASCII banner in the OS X Terminal. The Mac OS/BSD banner command behaves differently from the CentOS banner command, it actually makes printer ready ascii banners like I was trying to do with my python script. So moving forward I can either switch to the Mac OS banner command, or use it to generate better characters for my python script.

Back to the Main Page