Search code examples
c#browserdrawtobitmap

Converting WebBrowser.Document To A Bitmap?


Is it possible to draw a WebBrowser.Document to a Bitmap? Basically taking a screenshot of a WebBrowser control (note, this is with a WebBrowser that doesn't live on a form, but just in code).

WebBrowser w = new WebBrowser();
w.Document = "<b>Hello</b> world.";
w.Document.DrawToBitmap ???

Thanks!


Solution

  • http://www.bryancook.net/2006/03/screen-capture-for-invisible-windows.html

    and here:

    http://www.codeproject.com/KB/graphics/screen_capturing.aspx

    I believe you should get the handle of your WebBrowser control and save it's content as image like suggested in those links.