TWebBrowser save to EMF



Hello,

I make desperate efforts to save the Canvas from a TWebBrowser to an
EMF. That´s about the size of it:

procedure TForm1.Button7Click(Sender: TObject);
var
sourceDrawRect: TRect;
mf : TMetaFile;
mfCanvas : TMetafileCanvas;
ViewObject : IViewObject;
begin
with WebBrowser1 do
begin
Height := OleObject.Document.ParentWindow.Screen.Height;
Width := OleObject.Document.ParentWindow.Screen.Width;

mf := TMetafile.Create();

try
sourceDrawRect := Rect(0, 0, Width, Height);
mf.MMWidth := Width;
mf.MMHeight := Height;

mfCanvas := TMetafileCanvas.Create(mf, GetDC(0));

Webbrowser1.Document.QueryInterface(IViewOBject, ViewObject);
if ViewObject <> nil then
OleCheck(ViewObject.Draw(DVASPECT_CONTENT, 1, nil, nil,
Self.Handle,
mfCanvas.Handle,
@sourceDrawRect, nil, nil, 0));
mfCanvas.Free;
mf.SaveToFile('.\test.emf');
finally
mf.Free;
end;
end;
end;

If I have a look at the EMF file I can see that the function BitBlt is
used and this is not wanted. I have no idea how I can stop this
behaviour and save a "real" EMF.
Could someone please help me?

Thanks,
Thomas

.


Quantcast