|On this page…|
A printer driver formats your figure into instructions that your printer understands. There are two main types of MATLAB® printer drivers: built-in and Ghostscript. See the Printer Driver table on the print reference page for a complete list of supported drivers. Specifying the printer driver does not change the selected printer. This following sections provide information to help you decide which printer driver to use when printing your figure.
Built-in MATLAB drivers are written specifically for it and include Windows®, PostScript®, and HP-GL® output formats.
The built-in Windows printer drivers enable your print requests to work with the Windows Print Manager. The Print Manager enables you to monitor printer queues and control various aspects of the printing process.
HP-GL support is provided for the HP® 7475A plotter and fully compatible plotters. HP-GL files can also be imported into documents of other applications, such as Microsoft® Word, although add-on filters for them may be needed.
Ghostscript drivers use Ghostscript to convert your figure into printer-model-specific instructions. MATLAB generates a PostScript representation of the figure and Ghostscript generates the printer instructions from that. Examples of Ghostscript drivers are Epson® and HP.
The choice of printer driver depends upon several considerations:
The following flowchart gives an overview of how to choose a driver based on the platform you are using and the type of printer you have.
Deciding What Type of Printer Driver to Use
On Windows systems, you can use any of the driver types shown in the flowchart. If you use the Windows driver, you can use the Windows Print Manager.
On UNIX®, you can use either PostScript or Ghostscript drivers.
On either platform, if you have a PostScript-compatible printer, it is better to use a PostScript driver than a Ghostscript driver, because doing so avoids the unnecessary Ghostscript conversion step and is likely to create more accurate renditions.
Printer support is different among the Windows, PostScript, and Ghostscript drivers. Consult the manual for your printer to see what driver to use.
Windows drivers support most printer models, but sometimes the printer's native driver is incompatible with the MATLAB Windows driver. If you are getting printing errors, see Trouble with Windows Native Drivers.
Some Ghostscript drivers are specific to certain printer models. For example, different drivers support the HP DeskJet 500, 500C, and 550C models, plus a generic driver for the series. When this is the case, try the model-specific driver first. If that doesn't work, try the generic driver.
By default, a black-and-white driver is used. The built-in MATLAB and Ghostscript drivers print both color and black and white. The Printer Drivers table on the print reference page indicates which drivers are color.
Colored surfaces and images print in grayscale when you use a black-and-white driver. Colored lines and text can be printed in color, grayscale, or black and white, depending on the color support of the driver and color capability of your printer. Results can vary depending on whether images, text, lines, patches, or surfaces are being printed.
In MATLAB, the fonts supported for printing depend upon the MATLAB printer driver you specify and sometimes upon which platform you are using.
PostScript and Ghostscript Supported Fonts. The table below lists the fonts supported by the MATLAB PostScript and Ghostscript drivers when generated with the Painters renderer (fully vectorized output). This same set of fonts is supported on both Windows and UNIX. In some cases the supported fonts might not be available for the screen display, but they are still used for printing or exporting. This might result in a difference between the screen display and the generated output.
Any font not on the previous list is replaced with Courier, with the exception of the fonts listed below. This table shows the replacement rules which apply to the specified fonts. If you specify a font listed in the first column, then the Painters renderer generates output using the corresponding font in the second column.
|MATLAB Specified Font||Font Used in Output|
If you set the font using the set function, use the names exactly as shown above. This example sets the font of the current text object to Helvetica-Narrow using MATLAB commands.
set(gca, 'FontName', 'Helvetica-Narrow');
If you use the Property Editor dialog box (available under Axes Properties or Current Object Properties on the Edit menu) to set the font, the list of available fonts shows those that are supported by your system. If you choose one that is not in the table above, your resulting file uses Courier.
Windows Drivers Supported Fonts. The MATLAB Windows drivers support any system-supported font. To see the list of fonts installed on your system, open the Font name list on the Text or Style tab of the Property Editor.
If you use the set function to set fonts, type in the name exactly as it appears in the Property Editor. For example, if you have the Script font installed on your system, set the title of your figure to Script using the following code.
h = get(gca, 'Title'); set(h, 'FontName', 'Script');
If you specify a font supplied with MATLAB that is not available on your platform as a system font, figures might not print or export properly.
Some print settings are only supported by specific drivers. This table summarizes the settings and which driver supports them.
Appending figures to a PostScript file
BoundingBox (setting figure to print uncropped)
Resolution set with user interface
Resolution set with print function
This section provides additional information about the various types of printer drivers available to MATLAB users. It covers the following topics:
When you specify a Windows driver (-dwin or -dwinc), this is interpreted to mean that the print request will use the Windows Print Manager. It also means that the default Windows driver will be assigned based on your current printer's color property setting. In other words, MATLAB does not differentiate between -dwin or -dwinc in printopt.m and you might not get the expected output color: if you choose -dwin, lines and text will print in black and white; with -dwinc, lines and text print in their screen colors (assuming your printer does print in color).
There are two ways to ensure that -dwin or -dwinc are used: specify the driver when you print, or use the printer's Document Properties dialog box to set the default driver.
You can use the printer's Document Properties dialog box to set the default driver for all print requests. This dialog box sets the printer's color property, which in turn sets the default Windows driver.
To access this dialog box, click the Properties button on the Windows Print or Print Setup dialog box. See your Windows and printer's documentation if you need help with this dialog box. Document Properties dialog boxes vary from printer to printer.
Sometimes, even when you use the Windows Document Properties dialog box, you can receive incorrect color results because some Windows printers return inaccurate information about their color property setting.
Occasionally, printing problems are due to a bug in the native printer driver or an incompatibility between the native printer driver and the MATLAB driver.
If you are having trouble, try installing a different native printer driver. A newer version might be available from the manufacturer or reseller. You may also be able to use the native driver from a different printer, such as an earlier model from the same manufacturer.
If this doesn't help, try using a PostScript or Ghostscript driver.
Choosing between the Level 1 and Level 2 MATLAB PostScript drivers does not affect the quality of your output. Make the choice based on what your printer supports and on any file size or speed concerns.
Level 1 PostScript produces good results on a Level 2 printer, but Level 2 PostScript does not print properly on a Level 1 printer.
Level 2 PostScript files are generally smaller and render more quickly than Level 1 files. If your printer supports Level 2 PostScript, use one of the Level 2 drivers. If your printer does not support Level 2, or if you're not sure, use a Level 1 driver.
In the future PostScript Level 1 support will be removed and MATLAB will generate PostScript Level 2 instead.
If you have an early PostScript 1 printer, such as some of the PostScript printers manufactured before 1990, you may notice problems in the text of PostScript printouts. Your printer might not support the ISOLatin1Encoding operator that the MATLAB driver uses for PostScript files. If this is the case, use the Adobe® PostScript default character-set encoding. You can specify this by using the -adobecset option with the print command.
The HP-GL driver cannot do background fills. Therefore, you should ensure that your figure is set to print with a white background (the default), and that any lines and text in your figure are drawn in a color dark enough to be seen on a white background. For more information about background color, see Setting the Background Color.
The HP 7475A plotter supports six pens, none of which can be white. If the MATLAB driver tries to draw in white while rendering in HP-GL mode, the driver ignores all drawing commands until a different color is chosen.
Pen 1, which is assumed to be black, is used for drawing axes. The remaining pens are used for the first five colors specified in the ColorOrder property of the current axes object. If ColorOrder specifies fewer than five colors, the unspecified pens are not used.
For Simulink® systems, which ordinarily use a maximum of eight colors, the six pens available on the plotter are assumed to be
Pen 1: black
Pen 2: red
Pen 3: green
Pen 4: blue
Pen 5: cyan
Pen 6: magenta
If you attempt to draw a MATLAB graphic object containing a color that is not a known pen color, the driver chooses the nearest approximation to the unlisted color.
The HP-GL driver has these limitations:
Display colors and plotted colors sometimes differ.
Areas (faces on mesh and surface plots, patches, blocks, and arrowheads) are not filled.
There is no hidden line or surface removal.
Text is printed in the plotter's default font.
Line width is determined by pen width.
Images and UI controls cannot be plotted.
Interpolated edge lines between two vertices are drawn with the pen whose color best matches the average color of the two vertices.
If you need to use a driver other than the default driver for your system, choose a new driver from the Printer Driver table on the print reference page, and set it either as a new default or just for the current figure you are working on.
If you do not indicate a specific printer driver, MATLAB uses the default driver specified by the variable dev in the printopt.m file. The factory default driver depends on the platform.
Factory Default Printer Driver
UNIX & Macintosh
Black-and-white Level II PostScript
To change the default driver for all figures, edit printopt.m and change the value for dev to match one of the driver codes listed in the Printer Drivers table on the print reference page (printopt.m contains instructions for modifying it). See Setting Defaults Across Sessions for details.
You can change the printer driver from the MATLAB command line. To specify a nondefault printer driver for the figure you are printing, include the -d switch with the print command. For example, to print the current figure using the MATLAB built-in Windows color printer driver winc, type