
Procedure TForm1.Button1Click(Sender : TObject) Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, activeX,ĭialogs, ExtCtrls, StdCtrls, OleCtrls, SHDocVw_TLB ANd you must do this before I come up with a solution myself.for Delphi 5 Enterprise SendMessage(HTMLWindow3, wm_Print, integer(), prf_Children or prf_Client or prf_NonClient) Īgain to receive the 333 points you must deliver a functional code snippet that will render the "contents", not necessarily viewable "contents" into an image component or saved to a bitmap file. SendMessage(webbrowser1.hw nd, wm_Print, integer(), prf_Children or prf_Client or prf_NonClient) However, if I try to capture this print to a Bitmap canvas, I get an unknown exception from various iterations of the code below Raise Exception.Create('Couldn'' t convert the WebBrowser to an IHTMLDocument2') HTMLDoc := (Sender as TWebBrowser).Document as IHTMLDocument2 Procedure TMainForm.WebBrowser1Docum entComplet e(Sender: TObject Ĭonst pDisp: IDispatch var URL: OleVariant) I can print the WEbBrowser window regardless of visiblity in this manner: However, if part of the web page is not viewable due to the size of the desktop, it does not end up in the image. ViewObject.Draw(DVASPECT_C ONTENT, 1, nil, nil, Self.Handle,image1.Canvas. SourceDrawRect := Rect(0, 0, Image1.Width, Image1.Height)

Image1.height := webBrowser1.clientheight Procedure TmainForm.createimage3(Sen der: TObject) I can capture what is visible in TWebBrowser into a bitmap file thusly
.jpg)

I will give 333 points if someone comes up with the answer to this before me.
