DynaPDF Manual - Page 549

Previous Page 548   Index   Next Page 550

Function Reference
Page 549 of 839
However, the old non-portable WMF format is device depended; it contains no size information in
the file's header so that this file type must be handled separately. The conversion function
SetWinMetaFileBits() requires a parameter of the type METAFILEPICT, this structure is only
initialized to default values by DynaPDF for non-portable WMF files:
METAFILEPICT pict;
pict.hMF
= NULL;
pict.mm
= MM_ANISOTROPIC;
pict.xExt = 0;
pict.yExt = 0;
The picture size is set to zero so that the GDI must calculate the size. WMF files converted in this
way are often stretched. To get correct output results you must set the width and height of the WMF
file manually with the function SetWMFDefExtent(). The size must be calculated in 0.01 millimetre
units. A widely used size is 210000 x 280000 units for high resolution metafiles.
Notice: Missing lines or other objects indicates that the output size is too small. The GDI function
SetWinMetaFileBits() removes records which would be invisible or too small to appear in the
requested size. Set the output size to a larger value in this case.
Portable WMF files
The usage of portable WMF files is the same as of normal EMF files. However, many people want or
must to personalize WMF files with additional contents and many of them have problems to
calculate the correct WMF picture size which is required to get a correct EMF file. Let's see how
DynaPDF calculates the size of a WMF file:
First, we need the header of the WMF file because the structure contains the size of the WMF file.
The WMF header is defined as follows:
struct TRectS
{
SI16 Left;
SI16 Top;
SI16 Right;
SI16 Bottom;
};
#include <pshpack2.h>
// packed structure
struct TPORT_METAHEADER // 16 bit portable WMF file
{
UI32 Key;
// WMF identifier (must be 0x9AC6CDD7)
SI16 Handle;
// Number of handles in file
TRectS BBox;
// Bounding rectangle
UI16 Inch;
// Pixels per inch
UI32 Reserved;
UI16 CheckSum; // Aldus checksum
};
#include <poppack.h>
 

Previous topic: Font selection in EMF files, Character sets, Non-portable WMF files

Next topic: ROP Codes (Raster Operation Codes)