Emacs provides commands for printing hardcopies of either an entire buffer or part of one. You can invoke the printing commands directly, as detailed below, or using the ‘File’ menu on the menu bar.
Aside from the commands described in this section, you can also print hardcopies from Dired (see Operating on Files) and the diary (see Displaying the Diary). You can also “print” an Emacs buffer to HTML with the command M-x htmlfontify-buffer, which converts the current buffer to a HTML file, replacing Emacs faces with CSS-based markup. Furthermore, Org mode allows you to “print” Org files to a variety of formats, such as PDF (see Org Mode).
print-bufferbut print only the current region.
lpr-bufferbut print only the current region.
On most operating system, the above hardcopy commands submit files
for printing by calling the lpr program. To change the
printer program, customize the variable
specify extra switches to give the printer program, customize the list
lpr-switches. Its value should be a list of option
strings, each of which should start with ‘-’ (e.g., the option
"-w80" specifies a line width of 80 columns). The
default is the empty list,
To specify the printer to use, set the variable
nil, specifies the default printer. If you set it
to a printer name (a string), that name is passed to lpr
with the ‘-P’ switch; if you are not using lpr, you
should specify the switch with
lpr-headers-switches similarly specifies the
extra switches to use to make page headers. The variable
lpr-add-switches controls whether to supply ‘-T’ and
‘-J’ options (suitable for lpr) to the printer program:
nil means don't add them (this should be the value if your
printer program is not compatible with lpr).