Easy HTML Screen Capture in Windows

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.

 

I lead the Chrome Developer Relations team at Google.

We want people to have the best experience possible on the web without having to install a native app or produce content in a walled garden.

Our team tries to make it easier for developers to build on the web by supporting every Chrome release, creating great content to support developers on web.dev, contributing to MDN, helping to improve browser compatibility, and some of the best developer tools like Lighthouse, Workbox, Squoosh to name just a few.

I love to learn about what you are building, and how I can help with Chrome or Web development in general, so if you want to chat with me directly, please feel free to book a consultation.

I'm trialing a newsletter, you can subscribe below (thank you!)