Method DrawMetafile

Top  Previous  Next

You can use this procedure to draw a metafile which was created by a component such as WPForm or QuickReport. The x and y parameters are the position on the PDF page. 'Meta' is the handle of the metafile, provided by TMetafile.Handle.

If you have created the metafile using the screen as reference please provide the x and y resolution in the last 2 parameters of procedure DrawMetafileEx. (all parameters can be set to 0 except for 'handle')

 

Now you can also use DrawMetafileEx if you want to also provide a width and height parameter.

 

procedure TForm1.WPPDFExport1BeforePrintPage(Sender: TObject; Number, FromPos, Length: Integer);

var

 TheMetafile: HENHMETAFILE;

begin

 TheMetafile := GetEnhMetaFile('c:\test.emf');

 WPPDFExport1.DrawMetafile(0, 0, TheMetafile);

 DeleteEnhMetaFile(TheMetafile);

end;