This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan
<p>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.</p> <p>It just so happens that the WindowsLiveWriter API has an object called HtmlScreenCapture. </p> <p>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.</p> <blockquote> <p>Uri uri = new Uri("<a href="http://www.kinlan.co.uk/%22);">http://www.kinlan.co.uk/");</a> </p>
<p>WindowsLive.Writer.Api.HtmlScreenCapture hsc = new HtmlScreenCapture(uri, 800);pictureBox1.Image = hsc.CaptureHtml(1000);</p>
</blockquote> <p>You can import the WindowsLiveWriter API into your project by finding the WindowsLive.Writer.Api.dll file in the WindowsLiveWriter install directory. </p><p>Obviously, WindowsLiveWriter is still beta as of Jan 2007, so they may remove this API. </p><p>Anyway it is really simple to use, so anyone could create an imaging service in minutes, much like <a href="http://www.websnapr.com/" title="http://www.websnapr.com/">http://www.websnapr.com/</a> can. </p><p> </p> <div class="wlWriterSmartContent" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px;">Topicala Tags: <a href="http:/www.topicala.com/tag/windowslivewriter" rel="tag">windowslivewriter</a>, <a href="http:/www.topicala.com/tag/c#" rel="tag">c#</a>, <a href="http:/www.topicala.com/tag/image" rel="tag">image</a>, <a href="http:/www.topicala.com/tag/screen%20capture" rel="tag">screen capture</a>, <a href="http:/www.topicala.com/tag/winform" rel="tag">winform</a>, <a href="http:/www.topicala.com/tag/.net" rel="tag">.net</a>, <a href="http:/www.topicala.com/tag/HtmlScreenCapture" rel="tag">HtmlScreenCapture</a>, <a href="http:/www.topicala.com/tag/live%20writer" rel="tag">live writer</a>
</div>
This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan