I'm sure that you've encountered the problem before, at some point in your lifetime. You're trying to print a nice plain text document, and you don't want to bother with enscript or a2ps. So you whip out lpr and you run something like 'lpr my_file.txt'.

Of course, life is never so easy or kind with us, is it? Instead of getting the nicely formatted text file that you hoped to get, you have the tops and bottoms of your document cut off because the margins aren't quite right with your printer, and you also don't get any page numbers of heading because, well, you don't want that, right?

If you're using CUPS like I am, you've undoubtedly wondered how to fix this little problem. Until a little while ago, I wasn't bothered enough to figure out how to correctly do it. As it turns out, a single search to Cuil lead me forthwith to a solution.

To solve this little sticky wicket, just use the lpoptions command. You can set various printer settings with it, including a few special ones that are reserved exclusively for plain text print jobs. It will edit the /etc/cups/lpoptions file to store your settings. Here are the settings I gave it:

  • prettyprint
  • page-{left,right,top,bottom}=72
  • cpi=13


This gives me one inch margins, 84 columns of text, and a header with a job name, date, and page number. Voila!