print, printopt

Purpose

Create hardcopy output of current figure window.

Synopsis

print
print [-ddevicetype] [-options] [filename]
[pcmd,dev] = printopt

Description

print with no arguments sends the contents of the current figure window to the default printer.

print filename saves the current figure window to the designated filename in the default device format. If filename does not include an extension, then an appropriate extension like .ps or .eps is appended to it, depending on the default device.

Directly supported device types include:

----------------------------------------------------------
Device   Description                                        
----------------------------------------------------------
-dps     PostScript for black and white printers            
-dpsc    PostScript for color printers                      
-dps2    Level 2 PostScript for black and white printers    
-dpsc2   Level 2 PostScript for color printers              
-deps    Encapsulated PostScript (EPSF)                     
-depsc   Encapsulated color PostScript (EPSF)               
-deps2   Encapsulated Level 2 PostScript (EPSF)             
-depsc2  Encapsulated Level 2 color PostScript (EPSF)       
-dhpgl   HPGL compatible with HP 7475A plotter              
-dill    Adobe Illustrator 88 compatible illustration file  
----------------------------------------------------------
In general, Level 2 PostScript files are smaller and render more quickly when printing. However, not all PostScript printers support Level 2, so try to determine the capabilities of your printer before using the print command.

Additional devices supported via the Ghostscript post processor, which converts PostScript files into other formats, are listed below. This feature is available only on UNIX and PC systems.

---------------------------------------------------------------------------
Ghostscript   Description                                                    
Device                                                                       
---------------------------------------------------------------------------
-dlaserjet    HP LaserJet                                                    
-dljetplus    HP LaserJet+                                                   
-dljet2p      HP LaserJet IIP                                                
-dljet3       HP LaserJet III                                                
-dcdeskjet    HP DeskJet 500C with 1 bit/pixel color                         
-dcdjcolor    HP DeskJet 500C with 24 bit/pixel color and high-quality       
              color (Floyd-Steinberg) dithering                              
-dcdjmono     HP DeskJet 500C printing black only                            
-ddeskjet     HP DeskJet and DeskJet Plus                                    
-dpaintjet    HP PaintJet color printer                                      
-dpjetxl      HP PaintJet XL color printer                                   
-dbj10e       Canon BubbleJet BJ10e                                          
-dln03        DEC LN03 printer                                               
-depson       Epson-compatible dot matrix printer (9- or 24-pin)             
-deps9high    Epson-compatible 9-pin, interleaved lines (triple resolution)  
-depsonc      Epson LQ-2550 and Fujitsu 3400/2400/1200 color printers        
-dgif8        8-bit color GIF file format                                    
-dpcx16       Older color PCX file format (EGA/VGA, 16-color)                
-dpcx256      Newer color PCX file format (256-color)                        
                                                                             
---------------------------------------------------------------------------
print -options filename specifies an additional print option. Options supported on all devices are:

----------------------------------------------------
Option     Description                                 
----------------------------------------------------
-append    Append to specified file, do not overwrite  
-epsi      Add 1-bit deep EPSI preview                 
-Pprinter  Specify printer to use                      
-fhandle   Handle of figure to print                   
-sname     Name of SIMULINK system window to print     
----------------------------------------------------
MS-Windows-only devices and options are:

-------------------------------------------------------------
Windows   Description                                          
Option                                                         
-------------------------------------------------------------
-dwin     Use Windows printing services                        
-dwinc    Use color Windows printing services                  
-dmeta    Put on clipboard in Windows metafile format          
-dbitmap  Put on clipboard in Windows bitmap format            
-dsetup   Bring up Print Setup dialog box, but do not print    
-v        Verbose mode - bring up Print dialog box (normally   
          suppressed)                                          
-------------------------------------------------------------
Macintosh-only devices and options are:

---------------------------------------------------------------
Mac Option  Description                                          
---------------------------------------------------------------
-dmac       Send figure, in monochrome, to currently installed   
            printer                                              
                                                                 
---------------------------------------------------------------
By default, MATLAB changes the normally black figure background color to white and changes the normally white axis lines and labels to black. You can maintain the white on black figure colors by setting the InvertHardCopy figure property to off:

set(gcf,'InvertHardCopy','off')
To obtain hardcopy output that matches what you see on the screen, set InvertHardCopy to off and select a color device type. You must send the file to a color printer unless the figure colormap is a grayscale (such as that created with colormap(gray)). In addition, to obtain true WYSIWYG output, you must adjust the width and height of the figure's PaperPostion property so that it has the same aspect ratio as the width and height of the figure's Position property. See figure for details.

MATLAB always produces graduated output for surfaces and patches, even for black and white output devices. However lines and text are printed in black or white.

Note that uicontrols and uimenus are not printed. See capture (UNIX systems only) to print a figure with these special widgets.

[pcmd,dev] = printopt returns strings describing the current settings for printopt, an M-file used by print that you or your system manager can edit to indicate your default printer type and destination. pcmd is a string containing the print command that print uses to spool a file to the printer. Its default is platform-dependent:

----------------------
UNIX       lpr -r        
Windows    PRINT         
Macintosh  unused        
VMS        PRINT/DELETE  
SGI        lp            
----------------------
dev is a string that contains the device options for the print command. Its default is also platform-dependent:

-------------------------
UNIX & VMS       -dps  
Windows             -dwin  
Macintosh           -dwin  
-------------------------

Example

The statement

print meshdata -depsc2
saves the contents of the current figure as Level 2 color Encapsulated PostScript in the file called meshdata.eps.

See Also

orient
All the properties of figure objects.

(c) Copyright 1994 by The MathWorks, Inc.