Search code examples
c#browserscreenshotgdi

Draw partial region of the webbrowser - using IViewObject.Draw()


I'm using WebBrowser control to take screen shots of web pages and I'm able to get it working using IViewObject.Draw(). My question is that how can I draw partial region of the control. For example from (0px, 0px) to (200px, 200px).

Any insights?


Solution

  • I found a solution pretty much close to what I want. I ran JQuery scripts in the WebBrowser using InvokeScript() and hid all the controls in the page except what I want to take a screen shot. It worked well.

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