1

I would like to choose which printer is used for printing in Emacs. Before I can set printer-name to something, I need to know the names of the available printers. Under Windows, I can see the available printers in the "Devices and Printers" control panel, but that does not give me names I can use in Emacs. Under BSD or Linux I could use lpstat -d, but lpstat doesn't seem to be available in either Windows or the Cygwin command sets. cygcheck -p /lpstat only returns entries related to lpstat and not the tool its self. Is there another way to enumerate the available printers under Cygwin/Windows?

Windows 10 Professional Ver 10.0 Build 14393 emacs-w32 25.1-1

2

Well it turns out that the long-complicated-names-with-goobers listed in the "Devices and Printers" "Control Panel" / "Windows Settings" really are the printer names... ick.

(setq printer-name "Microsoft Print to PDF") M-x ps-print-buffer
does in fact generate a PDF file via Emacs.

The list of names in the "Control Panel" is confirmed by: cscript.exe prnmngr.vds -l and get-wmiobject -class win32_printer in PowerShell. get-printer also lists the printer names, but it truncates the long ones so it's useless.

Fortunately, printers can be renamed with rename-printer -name "HP Color LaserJet Pro MFP M477" -newname "hp477" in PowerShell, or through "Printer properties" in the GUI. (The printer must be on.)

Unfortunately, it seems that the built in printers, such as the Microsoft PDF printer, don't allow their lengthy names to be changed at all.

  • How do you list the printers within cygwin? cscript.exe prnmngr.vds -l gives me an error about the ending .vds. – lucidbrot May 10 '17 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.