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?

  • 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
    Commented Apr 3, 2013 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
    Commented Apr 4, 2013 at 1:03
  • Many Linux systems and MacOS use CUPS. That the "user visible command" is lpr is just for backwards compatibility.
    – vonbrand
    Commented Apr 4, 2013 at 1:05
  • Yes, the hplip library I mentioned does include CUPS backend drivers.
    – Greg Marks
    Commented Apr 4, 2013 at 1:15

1 Answer 1


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .