Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Printing a text file with lpr produces output with a large Monaco font and very thin margins. Is there a way to change the font and the margins when you use lpr on OS X?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

lp allows you to specify margins and text size. According to the man lp:

-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.

EXAMPLES

Print a double-sided legal document to a printer called "foo":
    lp -d foo -o media=legal -o sides=two-sided-long-edge filename

Print an image across 4 pages:
    lp -d bar -o scaling=200 filename

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
share|improve this answer

I defined a command mylpr (in ~/bin) as follows:

#!/bin/bash
ENSCRIPT="--no-header --margins=36:36:36:36 --font=Courier11 --word-wrap --media=Letter"
export ENSCRIPT
/usr/bin/enscript -p - $1 | /usr/bin/lpr

then I also added lines

(require 'lpr)
(setq my-print-command "~/bin/mylpr")
(setq lpr-command my-print-command)

to my ~/.emacs and ~/.xemacs/custom.el files. This took care of all my instances of printing in 12-pt Monaco without margins.

share|improve this answer
    
oops... I hope what I posted above is clear enough... I can't edit or comment, so I thank any other user who will do it. Notice that there should be a ";", or a new line, after "export ENSCRIPT". –  user119153 Feb 19 '12 at 20:04
    
Fixed up for you :) –  Simon Sheehan Feb 19 '12 at 21:15

Your Answer

 
discard

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.