Linux – number of characters per line printed by lpr

linuxlprunix

How do I set the number of characters per line when printing a file using lp or lpr? It seems like it's fixed at 80.

Best Answer

You can set the number of characters per inch with -o cpi and the margins in points (72 per inch) with -o page-left and -o page-right. For example:

       lp -d main -o cpi=10 -o lpi=8 -o page-left=72 -o page-right=72 filename

would print 75 characters per line (assuming a fixed width font and an 8.5 inch wide page).

From man lp on a CUPS-based system (Ubuntu 9.10):

Example:
       Print a text file with 12 characters per inch, 8 lines per inch, and  a
       1 inch left margin:
           lp -d bar -o cpi=12 -o lpi=8 -o page-left=72 filename

and

       -o cpi=N
            Sets the number of characters per inch to use when printing a text
            file. The default is 10.

       -o lpi=N
            Sets the number of lines per inch to  use  when  printing  a  text
            file. The default is 6.

       -o page-bottom=N

       -o page-left=N

       -o page-right=N

       -o page-top=N
            Sets  the page margins when printing text files. The values are in
            points - there are 72 points to the inch.