libUEMF
A portable library for reading and writing WMF, EMF and EMF+ files
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
libUEMF overview

Overview

Microsoft's WMF, EMF, and EMF+ metafile types are supported. In each case functions are provided for reading, constructing, writing, and printing metafile records. The methods used to do that differ somewhat between metafiles, and the simplest way to get started is to have a look at the example programs provided. The WMF, EMF, and EMF+ structs and functions are marked with U_WMF, U_EMF, U_PMF and U_WMR, U_EMR, and U_PMR prefixes. (PMF because "+" is a reserved character in many contexts, so U_EMF+NAME would be a problem.) Please be aware that normally both EMF and EMF+ files have the ".emf" file extension, and that it is very common for such files to contain both an EMF and an EMF+ representation of the drawing.

Example Programs

testbed_emf.c Creates an EMF file test_libuemf.emf.
testbed_wmf.c Creates a WMF file test_libuemf.wmf.
testbed_pmf.c Creates an EMF+ file test_libuemf_p.emf.
reademf.c Reads an EMF or EMF+ file and emits a text summary of its records.
readwmf.c Reads a WMF file and emits a text summary of its records.
emf-inout.cpp.example Example code from Inkscape to convert graphics from EMF to SVG.
emf-print.cpp.example Example code from Inkscape to print a drawing to EMF.
wmf-inout.cpp.example Example code from Inkscape to convert graphics from WMF to SVG.
wmf-print.cpp.example Example code from Inkscape to print a drawing to WMF.

Documentation issues

There are currently some unresolved issues with Doxygen that result in some structs not being "defined". This comes up when several different types of structs have the same layout. When this occurs the first one listed on the "typedef struct" is defined but all the others will only be shown under "typedef struct" referring to the first one. This is why clicking on U_RECTL in a function parameter jumps to a typedef struct page, why U_RECTL is shown as plain text here, but U_RECT is shown as a link here, and clicking on it jumps directly to its structure definition.

An additional issue is that the Enumeration names used in WMF are different from those used in EMF, even when the values are either identical or differ only slightly, and no method has been found yet to link one to the other in Doxygen. At present the only way to look up these WMF enumerations is by referencing the following table:

    EMF                                        WMF                                              WMF Manual
    EMF Binary Raster Operation Enumeration    BinaryRasterOperation Enumeration                2.1.1.2
    EMF Bitcount Enumeration                   BitCount Enumeration                             2.1.1.3
    EMF LB_Style Enumeration                   BrushStyle Enumeration                           2.1.1.4
    EMF LF_CharSet Enumeration                 CharacterSet Enumeration                         2.1.1.5
    EMF DIBColors Enumeration                  ColorUsage Enumeration  [has 1 extra value]      2.1.1.6
    EMF BI_Compression Enumeration             Compression Enumeration [has 3 extra values]     2.1.1.7
    -                                          FamilyFont Enumeration                           2.1.1.8
    EMF FloodFill Enumeration                  FloodFill Enumeration                            2.1.1.9
    EMF LF_Quality Enumeration                 FontQuality Enumeration                          2.1.1.10
    EMF LCS_Intent Enumeration                 GamutMappingIntent Enumeration                   2.1.1.11
    EMF HatchStyle Enumeration                 HatchStyle Enumeration                           2.1.1.12
    EMF Mirroring Enumeration                  LayoutEnumeration                                2.1.1.13
    -                                          LogicalColorSpace Enumeration                    2.1.1.14
    EMF Profile Enumeration                    LogicalColorSpaceV5 Enumeration                  2.1.1.15
    EMF MapMode Enumeration                    MapModeEnumeration                               2.1.1.16
    -                                          MetaFilesEscape Enumeration                      2.1.1.17
    -                                          MetafileType Enumeration                         2.1.1.18
    -                                          MetafileVersion Enumeration                      2.1.1.19
    EMF BackgroundMode Enumeration             MixModeEnumeration                               2.1.1.20
    EMF LF_OutPrecision Enumeration            OutPrecision Enumeration                         2.1.1.21
    -                                          PaletteEntryFlag Enumeration                     2.1.1.22
    EMF PenStyle Enumeration                   PenStyle Enumeration [not values >0xFFFF]        2.1.1.23
    -                                          PitchFont Enumeration                            2.1.1.24
    EMF PolygonFillMode Enumeration            PolyFillMode Enumeration [first 2 only]          2.1.1.25
    -                                          PostScriptCap Enumeration                        2.1.1.26
    -                                          PostScriptClipping Enumeration                   2.1.1.27
    -                                          PostFeatureSetting Enumeration                   2.1.1.28
    -                                          PostScrioptJoin Enumeration                      2.1.1.29
    EMF StretchMode Enumeration                StretchMode Enumeration                          2.1.1.30
    EMF Ternary Raster Operation Enumeration   TernaryRasterOperation  Enumeration              2.1.1.31
    EMF LF_ClipPrecision Enumeration           ClipPrecision Flags                              2.1.2.1
    EMF ExtTextOutOptions Enumeration          ExtTextOutOptions Flags [subset]                 2.1.2.2
    EMF TextAlignment Enumeration              TextAlignment Enumeration                        2.1.2.3
    EMF TextAlignment Enumeration              VertialTextAlignment Enumeration                 2.1.2.4
    EMF LF_PitchAndFamily Enumeration          PitchAndFamily Enumerations                      2.2.2.14

Reference documentation

    Manual   Date        Link
    EMF      3/28/2012   http://msdn2.microsoft.com/en-us/library/cc230514.aspx
    EMF+     7/5/2012    http://msdn.microsoft.com/en-us/library/cc230724.aspx
    WMF      7/5/2012    http://msdn2.microsoft.com/en-us/library/cc250370.aspx