The topic of this page is printing from within Emacs. This includes printing Emacs buffers and regions. It includes printing using different operating systems, color printing, etc.

Ways to Print Emacs Buffers and Regions

Emacs comes with libraries printing.el, lpr.el, and ps-print.el, but they are not preloaded.

Tips on Printing


For those who wish to print on a local printer when running emacs through an ANSI terminal or alike (eg PuTTY), there is ansi-lpr ( (a library whose code length is less than its licence!). It allows users to print using the familiar commands (‘print-buffer’ or ‘print-region’) provided by lpr.el.

N.B. When downloading the library, make sure the control characters are still there – Matthias.

Printing with ps-print on MS Windows: Using Ghostscript

A way to easily print documents on Microsoft Windows is to add the following forms to your Emacs InitFile:

   (setenv "GS_LIB" "e:/tools/GSTools/gs8.14/gs8.14/lib;e:/tools/GSTools/gs8.14/fonts")
   (setq ps-lpr-command "e:/tools/GSTools/gs8.14/gs8.14/bin/gswin32c.exe")
   (setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2"))
   (setq ps-printer-name t)

You have to change the paths to reflect the actual directories on your system. The setenv form might not be necessary if GS_LIB is already set in the underlying environment.

This requires Ghostscript, but no extra Emacs library. You can print as usual with the “ps-print” commands. A pop-up will ask for the printer to send the output to.

Printing with ps-print on MS Windows: Using Cygwin and PDFCreator

Unfortunately, you should read the section Adware toolbar controversy on the Wikipedia page before installing it. :sucks:

If you decide to install it anyway, PDFCreator is a version of ghostscript & ghostview that acts like a windows printer driver. It allows you to create PDF’s from any windows application that will let you print.

You can tune the PDFCreator to do all sorts of things, I have it set to autosave the PDF and open it in Acrobat. Most Windows Emacsians have cygwin installed, this uses the cygwin version of lpr. To set Emacs up to use it add the following to your InitFile:

    (setenv "PRINTER" "PDFCreator")
    (cond ((eq system-type 'windows-nt)
       (setq ps-printer-name "PDFCreator")
       (setq ps-printer-name-option "-d")
       (setq ps-lpr-command "/bin/lpr"))) ; if you're using the Emacs in Cygwin
      ;(setq ps-lpr-command "c:/cygwin/bin/lpr.exe"))) ; if you're using the native Windows build of Emacs

To test use ps-print-buffer. – TimOCallaghan

Emacs does not allow quotes in the printer command or switches.

See PrintCommandQuotes for a work-around.

Printing with Word on MS Windows.

See PrintUsingWord.

Printing with preview

Create /usr/local/bin/print_preview:

  cat >"$PREVIEW_FILE" && evince "$PREVIEW_FILE" || \
      notify-send 'Print preview failed' --urgency=critical \

Configure Emacs:

  (setq ps-lpr-command "print_preview")

CategoryPrinting CategoryExternalUtilities