Linux

  1. Home
  2. Computing & Technology
  3. Linux

MS-DOS Printing

Emacs Documentation

By Juergen Haas, About.com

Printing and MS-DOS

Printing commands, such as lpr-buffer (see Hardcopy) and ps-print-buffer (see PostScript) can work in MS-DOS and MS-Windows by sending the output to one of the printer ports, if a Posix-style lpr program is unavailable. The same Emacs variables control printing on all systems (see Hardcopy), but in some cases they have different default values on MS-DOS and MS-Windows.

If you want to use your local printer, printing on it in the usual DOS manner, then set the Lisp variable lpr-command to "" (its default value) and printer-name to the name of the printer port--for example, "PRN", the usual local printer port (that's the default), or "LPT2", or "COM1" for a serial printer. You can also set printer-name to a file name, in which case "printed" output is actually appended to that file. If you set printer-name to "NUL", printed output is silently discarded (sent to the system null device).

On MS-Windows, when the Windows network software is installed, you can also use a printer shared by another machine by setting printer-name to the UNC share name for that printer-for example, "//joes_pc/hp4si". (It doesn't matter whether you use forward slashes or backslashes here.) To find out the names of shared printers, run the command net view at a DOS command prompt to obtain a list of servers, and net view server-name to see the names of printers (and directories) shared by that server. Alternatively, click the Network Neighborhood icon on your desktop, and look for machines which share their printers via the network.

If the printer doesn't appear in the output of net view, or if setting printer-name to the UNC share name doesn't produce a hardcopy on that printer, you can use the net use command to connect a local print port such as "LPT2" to the networked printer. For example, typing net use LPT2: \\joes_pc\hp4si1 causes Windows to capture the LPT2 port and redirect the printed material to the printer connected to the machine joes_pc. After this command, setting printer-name to "LPT2" should produce the hardcopy on the networked printer.

With some varieties of Windows network software, you can instruct Windows to capture a specific printer port such as "LPT2", and redirect it to a networked printer via the Control Panel->Printers applet instead of net use.

Some printers expect DOS codepage encoding of non-ASCII text, even though they are connected to a Windows machine which uses a different encoding for the same locale. For example, in the Latin-1 locale, DOS uses codepage 850 whereas Windows uses codepage 1252. See MS-DOS and MULE. When you print to such printers from Windows, you can use the C-x RET c (universal-coding-system-argument) command before M-x lpr-buffer; Emacs will then convert the text to the DOS codepage that you specify. For

* Emacs Manual Index

Explore Linux

About.com Special Features

Linux

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Software
  5. Editors
  6. Emacs
  7. Emacs Documentation - MS-DOS Printing

©2009 About.com, a part of The New York Times Company.

All rights reserved.