Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

How does MATLAB choose the default printer on Unix/Linux machines?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-1A8XJ
Product:   MATLAB
Reported in Release:   R13
Platform:   UNIX
Operating System:   UNIX Any
 

Subject:

How does MATLAB choose the default printer on Unix/Linux machines?

Problem Description:

How does MATLAB choose the default printer on Unix/Linux machines?

I would like to know how MATLAB determines the default printer, so I know what environment variables to change, or files to modify.

Solution:

By default, MATLAB uses the printer specified in the 'cmd' variable output from PRINTOPT (if one is specified). If there isn't a printer specified in printopt.m, then the LPDEST and PRINTER environment variables are checked.

If the system print command specified in printopt.m contains 'lpr', then PRINTER is used; if it contains 'lp', then LPDEST is used. In both cases, if the first variable used is undefined, then the other will be used. The default printer will then be added to the beginning of the available printer list.

If both LPDEST and PRINTER are undefined, then MATLAB looks for the following files, in order:

$HOME/printers.conf
/etc/printers.conf
/etc/printcap

It will use the first valid file it finds, and begin processing the printer information it contains. The first printer whose name is preceded by 'lp' in the file will become the default printer. If none of the printers names are preceded by 'lp', then the first printer listed will become the default.

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page