Troubleshooters.Com and T.C Linux Library Present

Make Yourself an Envelope Printer

Copyright (C) 2001, 2005 by Steve Litt
[ Linux Library | Troubleshooters.ComEmail Steve Litt | Copyright Notice ]

Linux apps fail surprisingly when it comes to making envelopes, at least on my HP4050. They print the wrong orientation. Or too high on the envelope, or other problems. Hours of messing with the apps fail to cure the problem. So I made my own envelope printer. Actually two -- one using the enscript command, and one using the a2ps command. You might like one of them.

The enscript Method


The enscript method has several advantages:
  1. You can specify your font size, family, and boldness.
  2. You needn't change a configuration file.
  3. It's entirely self-contained in a tiny shellscript.
In my opinion, unless you have a powerful reason to the contrary, use the enscript method.

Here's the envv shellscript implementing the enscript method:

#!/bin/bash
enscript -B -r -fCourierBold@12 --margins=170:0:0:150 $1

So all I do is create a text file (from cut and paste or a macro or program or whatever) that looks like this:

Steve Litt
359 Treeline Place
Apopka, FL 32703
                                 John Jones
                                 222 w 2nd
                                 Greenville, FL 32323
Assuming the text file is called johnjones.env, all I do is place the envelope in the feeder, and then run this command:
envv johnjones.env
If the envelope isn't to your liking, experiment with the font and margins.

The a2ps Method

 
NOTE

If you don't have the a2ps program on your system (it would probably be in /usr/bin), you can download the RPM. Go to http://www.rpmfind.net, and search for a2ps.

Call the following script envv, and put it on your path -- hopefully somewhere that won't get blown off the next time you reinstall:
 

#!/bin/sh
a2ps -r -columns=1 -f14 -M Littenv -P lp -B -i --borders=no $1
See that -M Littenv? It means "media name Littenv". What is Littenv, you may ask? I inserted the following line into my /etc/a2ps.cfg to implement the Littenv media type:
Medium: Littenv     297    1324    170 140   440 1420
Note that according to the documentation the preceding media shouldn't work at all. After discovering that the docs didn't match reality, I simply trial and errored till I got a working media.

So all I do is create a text file (from cut and paste or a macro or program or whatever) that looks like this:

Steve Litt
359 Treeline Place
Apopka, FL 32703
                                 John Jones
                                 222 w 2nd
                                 Greenville, FL 32323
 

 
 
 

Then, if I called that file env.txt I just go

$ envv env.txt
And my envelope prints out with nice 14point letters, properly placed.

I use a HP 4050. I'm sure your mileage will vary, but I'm equally sure you can do something like this to suit your envelope needs.

SteveT



 
[ Linux Library | Troubleshooters.ComEmail Steve Litt | Copyright Notice ]


Copyright (C)2001, 2005 by Steve Litt. -- Legal