Creating EMF (Enhanced Metafile Format) Graphics Using Universal Printing

EMF Graphics in SAS

Enhanced Metafile Format (EMF) graphics are scalable vector graphics that produce true color graphics. Applications that support EMF graphics run on Windows. The default output size of 800x600 pixels and the default resolution of 96 dpi produce output that closely resembles the screen resolution. EMF graphics are device-independent and are rendered by an EMF viewer.

supports three EMF metafile formats, EMF, EMFPlus, and EMFDual. The following table shows the EMF Universal Printers and their corresponding EMF metafile formats:

EMF Universal Printer

Type of EMF Metafile Format

Description

EMF

EMFPlus

The EMF Universal Printer creates a graphic that uses commands, objects, and properties in EMFPlus records. EMFPlus records have a different structure and use different commands, objects, and properties than those in EMF records. The output .emf file contains no EMF records, only EMFPlus records that are embedded within comment records.

The EMFPlus Universal Printer supports only TrueType fonts. If you specify another type of font, the font is mapped to the TrueType font.

EMFDual

EMFDual

The EMFDual Universal Printer creates both EMF and EMFPlus graphics in the same output file. The file that is presented is determined by the support of the EMF viewer.

Output from the EMFDual printer is large because it contains both EMF and EMFPlus formats.

SASEMF

EMF

The SASEMF Universal Printer creates EMF records that contain drawing commands, object definitions, and properties. Alpha channel color support is available only for images, not vector graphics. The SASEMF Universal Printer is equivalent to the EMF Universal Printer in previous releases of SAS.

EMFDual and SASEMF Universal Printers support TrueType and Type1 fonts. The EMF Universal Printer supports only TrueType fonts. Use the FONTREG to register Fonts. If you specify another type of font when the Universal Printer is EMF, the font is mapped to the TrueType font.

Compression and font embedding are not supported.

For a description of the EMF printers, submit the following QDEVICE procedure and view the output in the :

proc qdevice;
   printer emf-universal-printer;
run;

EMF printers do not support multiple page documents. If a procedure creates multiple pages or if more than one procedure is used in the code for PRINTER output, only the first page is viewable.

See Also

Creating an EMF Graphic

You can create a stand-alone EMF graphic using the ODS PRINTER . Specify the EMF Universal Printer either as the value of the PRINTERPATH= or as the value of the PRINTER= option in the ODS PRINTER statement. The following sample code specifies the EMF Universal Printer as the value of the PRINTER= option in the ODS PRINTER statement:

ods html close;
ods printer printer=emf;

...more SAS code...

ods printer close;
ods html;

SAS creates the file sasprt.emf in the current directory.

Example of Creating an EMF Graphic Using the ODS PRINTER Statement

Using the example Sashelp.Class and the SGPLOT procedure, the following ODS PRINTER statement prints the EMF file sasprt.emf in the current directory:

options printerpath=emf papersize=("4in" "4in") nodate;
ods html close;
ods printer;
proc sgplot data=sashelp.class;
  reg x=height y=weight / CLM CLI;
run;
ods printer close;
ods html;

The following output is the EMF metafile displayed in the Windows Picture and Fax Viewer:

Sashelp.Class in Enhanced Metafile Format
Sashelp.Class in Enhanced Metafile Format
Last updated: April 5, 2023