DynaPDF Manual - Page 538
Previous Page 537 Index Next Page 539
Page 538 of 821
When an EMF file is rendered to an image then it will be rendered in the resolution that was set
with SetResolution(). The default resolution is 150 DPI which is usually too low to achieve good
results. For good results the resolution should be set to 300 or 600 DPI.
How to convert spool EMF files?
EMF spool files contain EMF files for every page of a GDI print job. The spool file can also contain
embedded fonts which are required by the EMF files. These fonts must be loaded in a pre-
conversion step before the first EMF file can be converted. Embedded font subsets and
corresponding delta font records must also be converted to regular TrueType fonts.
The function ConvertEMFSpool() can be used to convert a complete spool file to PDF, or if you want
to use your own spool file parser, it can be used to load the embedded fonts from the spool file.
Note that you must set the flags mfUseUnicode and mfIgnoreEmbFonts with SetMetaConvFlags() if
only the spool fonts should be loaded. These flags are required in this case!
If you want to do anything manually with your own code then make sure that embedded font
subsets and corresponding delta fonts will be converted back to regular TrueType fonts with
Microsoft's function MergeFontPackage() of the fontsub.dll.
The resulting fonts as well as all other embedded fonts must be loaded with LoadFont() with the
code page cpGlyphIndexes or cpUnicode (cpGlyphIndexes is preferred). In addition, the flags
mfUseUnicode and mfIgnoreEmbFonts must be set with SetMetaConvFlags().
The code page cpGlyphIndexes or cpUnicode as well as the flag mfUseUnicode must be set to avoid
collusions with the internal font selection during EMF conversion. The flag mfIgnoreEmbFonts
makes sure that DynaPDF does not load the same embedded fonts again which are available in
DynaPDF versions prior 22.214.171.1246 were not able to load spool fonts automatically. It was
required to load the fonts in the user's temp directory manually with AddFontSearchPath() and
the font cache had to be cleared before the next spool file could be converted. This technique
was rather inefficient and is no longer supported. Existing applications should be changed to
avoid the unnecessary calls of AddFontSearchPath() and ClearHostFonts().
AddFontSearchPath() does no longer load fonts with the extension tmp.
DynaPDF supports several flags to convert metafiles files to PDF, see SetMetaConvFlags() for
further information. Because the GDI function SetWinMeatFileBits() is used to convert WMF files to
EMF, WMF files are not supported on Mac OS X, Linux or UNIX.
If the function succeeds the return value is 1. If the function fails the return value is 0.
Previous topic: ROP Codes (Raster Operation Codes)
Next topic: InsertMetafileEx