I use the procedure below to create a JPG file from a TWebbrowser That is resulting in a JPG looking OK Then I load this JPG to a TcxImage control from DevExpress in order to print it. And that messes up my image so it isn't possible to see the map (it is a portion of a map from Google Maps) The code for loading the image is
imgPrint.Picture.LoadFromFile(lImage);
I don't quite get why this is looking so bad already on screen. I do it this way in order to be able to print the map. It could also be done direct from the TWebBrowser but ther I have no control of the output size and adding my own headers and footers are tricky.
procedure TfrmJsZipExplorer.actSaveExecute(Sender: TObject);
var
ViewObject : IViewObject;
r : TRect;
Bitmap: TBitmap;
begin
if WebBrowser1.Document <> nil then
begin
WebBrowser1.Document.QueryInterface(IViewObject, ViewObject) ;
if Assigned(ViewObject) then
try
Bitmap := TBitmap.Create;
try
r := Rect(0, 0, WebBrowser1.Width, WebBrowser1.Height) ;
Bitmap.Height := WebBrowser1.Height;
Bitmap.Width := WebBrowser1.Width;
ViewObject.Draw(DVASPECT_CONTENT, 1, nil, nil, Application.Handle, bitmap.Canvas.Handle, @r, nil, nil, 0);
with TJPEGImage.Create do
try
Assign(Bitmap);
SaveToFile(lImagefile);
finally
Free;
end;
finally
Bitmap.Free;
end;
finally
ViewObject._Release;
end;
end;
end;