Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Since upgrading to Ubuntu 12.04, the printing of plain text files with lpr on my HP LaserJet 2420 printer malfunctions in a very specific way: for each character that is supposed to be printed, the character that is actually printed is the one whose ASCII code is precisely 2 plus the ASCII code of the correct character. For instance echo "A" | lpr prints the letter C and echo "Z" | lpr prints the symbol \ and so forth. I have installed the standard hplip library. Does anyone know what might be causing this weird problem, and how to fix it?

share|improve this question
What printing system is this? Is there perhaps a bug report for this issue at Ubuntu? Everything up to date? All printing systems pass the input through a series of filters, check how you can find out what those filters are, and how they are run. Then you can go over each of them until you find the culprit. – vonbrand Apr 3 '13 at 21:54
Thank you for your suggestions. Lpr is one of the two standard UNIX printing systems, the other being enscript. To the best of my knowledge, there is no bug report on this "ASCII value plus 2" issue at Ubuntu. Everything on my machine is up to date. I ought to have mentioned that my problem does NOT occur with enscript, only with lpr. – Greg Marks Apr 4 '13 at 1:03
Many Linux systems and MacOS use CUPS. That the "user visible command" is lpr is just for backwards compatibility. – vonbrand Apr 4 '13 at 1:05
Yes, the hplip library I mentioned does include CUPS backend drivers. – Greg Marks Apr 4 '13 at 1:15

The same weird problem has occurred on a second computer that was upgraded from Ubuntu 10.04 to Ubuntu 12.04, connected to a different model HP LaserJet printer.  The cause and solution remain a mystery; however, Postscript printing still works, so the problem can be circumvented by a function such as the following in $HOME/.bashrc:

Lpr () {
paps --paper=letter --font="Courier 11" --bottom-margin=44 --top-margin=40 --left-margin=42 --right-margin=38 "$1" | /usr/bin/lpr
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.