Easy HTML Screen Capture in Windows

Paul Kinlan

For a while I have been thinking about how to capture the output of IE into a Bitmap or other image format.  The attempts that I have done normally center around hosting an IE control on a WinForm and then render the page inside the control and then capture the output.  This however seems to be pretty hairy, I could never get it to work after the initial screen capture.

It just so happens that the WindowsLiveWriter API has an object called HtmlScreenCapture. 

HtmlScreenCapture is really simle to use.  The code below captures the webpage and renders it to a picture box that I have on my WinForm.

Uri uri = new Uri("http://www.kinlan.co.uk/");

WindowsLive.Writer.Api.HtmlScreenCapture hsc = new HtmlScreenCapture(uri, 800);
pictureBox1.Image = hsc.CaptureHtml(1000);

You can import the WindowsLiveWriter API into your project by finding the WindowsLive.Writer.Api.dll file in the WindowsLiveWriter install directory.

Obviously, WindowsLiveWriter is still beta as of Jan 2007, so they may remove this API.

Anyway it is really simple to use, so anyone could create an imaging service in minutes, much like http://www.websnapr.com/ can.

 

Paul Kinlan

Trying to make the web and developers better.

RSS Github Medium