<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to get Website Thumbnail in C#</title>
	<atom:link href="http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-get-website-thumbnail-in-c</link>
	<description>Code and Effect - solving problem with just enough amount of code - by Adam Najmanowicz</description>
	<lastBuildDate>Tue, 24 Jan 2012 02:15:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Scot King</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-85364</link>
		<dc:creator>Scot King</dc:creator>
		<pubDate>Sat, 30 Jul 2011 05:40:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-85364</guid>
		<description>I&#039;m using application.doevents(0 and I get an error. I&#039;m not using your code. I&#039;m using someone elses code:

Error	8	&#039;System.Web.HttpApplicationState&#039; does not contain a definition for &#039;DoEvents&#039;

Doevents will work in a project but not a web application apprarantely. Did I miss something?  How can I get it to work in my website application?

 public Bitmap GenerateScreenshot(string url, int width, int height)
    {
        // Load the webpage into a WebBrowser control
        WebBrowser wb = new WebBrowser();
        wb.ScrollBarsEnabled = false;
        wb.ScriptErrorsSuppressed = true;
        wb.Navigate(url);
        while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }


        // Set the size of the WebBrowser control
        wb.Width = width;
        wb.Height = height;

        if (width == -1)
        {
            // Take Screenshot of the web pages full width
            wb.Width = wb.Document.Body.ScrollRectangle.Width;
        }

        if (height == -1)
        {
            // Take Screenshot of the web pages full height
            wb.Height = wb.Document.Body.ScrollRectangle.Height;
        }

        // Get a Bitmap representation of the webpage as it&#039;s rendered in the WebBrowser control
        Bitmap bitmap = new Bitmap(wb.Width, wb.Height);
        wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));
        wb.Dispose();

        return bitmap;
    }
   
}</description>
		<content:encoded><![CDATA[<p>I&#8217;m using application.doevents(0 and I get an error. I&#8217;m not using your code. I&#8217;m using someone elses code:</p>
<p>Error	8	&#8216;System.Web.HttpApplicationState&#8217; does not contain a definition for &#8216;DoEvents&#8217;</p>
<p>Doevents will work in a project but not a web application apprarantely. Did I miss something?  How can I get it to work in my website application?</p>
<p> public Bitmap GenerateScreenshot(string url, int width, int height)<br />
    {<br />
        // Load the webpage into a WebBrowser control<br />
        WebBrowser wb = new WebBrowser();<br />
        wb.ScrollBarsEnabled = false;<br />
        wb.ScriptErrorsSuppressed = true;<br />
        wb.Navigate(url);<br />
        while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }</p>
<p>        // Set the size of the WebBrowser control<br />
        wb.Width = width;<br />
        wb.Height = height;</p>
<p>        if (width == -1)<br />
        {<br />
            // Take Screenshot of the web pages full width<br />
            wb.Width = wb.Document.Body.ScrollRectangle.Width;<br />
        }</p>
<p>        if (height == -1)<br />
        {<br />
            // Take Screenshot of the web pages full height<br />
            wb.Height = wb.Document.Body.ScrollRectangle.Height;<br />
        }</p>
<p>        // Get a Bitmap representation of the webpage as it&#8217;s rendered in the WebBrowser control<br />
        Bitmap bitmap = new Bitmap(wb.Width, wb.Height);<br />
        wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));<br />
        wb.Dispose();</p>
<p>        return bitmap;<br />
    }</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Wood</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-53895</link>
		<dc:creator>Jonathan Wood</dc:creator>
		<pubDate>Sun, 19 Dec 2010 16:21:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-53895</guid>
		<description>One thing to be aware of is that some hosting sites might not allow the way this code creates an STA thread. On my CrystalTech hosting account, it works just fine. But I also have it on a GoDaddy grid hosting account and it fails miserably. The error I get cannot be caught as an exception. It seems to completely restart the request.

More details on this and my version of the code can be read at &lt;a href=&quot;http://blackbeltcoder.com/Articles/asp/creating-website-thumbnails-in-asp-net&quot; rel=&quot;nofollow&quot;&gt;http://blackbeltcoder.com/Articles/asp/creating-website-thumbnails-in-asp-net&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>One thing to be aware of is that some hosting sites might not allow the way this code creates an STA thread. On my CrystalTech hosting account, it works just fine. But I also have it on a GoDaddy grid hosting account and it fails miserably. The error I get cannot be caught as an exception. It seems to completely restart the request.</p>
<p>More details on this and my version of the code can be read at <a href="http://blackbeltcoder.com/Articles/asp/creating-website-thumbnails-in-asp-net" rel="nofollow">http://blackbeltcoder.com/Articles/asp/creating-website-thumbnails-in-asp-net</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Al</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-39288</link>
		<dc:creator>Al</dc:creator>
		<pubDate>Wed, 04 Aug 2010 06:22:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-39288</guid>
		<description>Great article! However Yahoo site doesn&#039;t work as well as several other sites. If anybody came up with the solution - please post. Thanks!</description>
		<content:encoded><![CDATA[<p>Great article! However Yahoo site doesn&#8217;t work as well as several other sites. If anybody came up with the solution &#8211; please post. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tworzenie stron</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-35885</link>
		<dc:creator>tworzenie stron</dc:creator>
		<pubDate>Mon, 31 May 2010 10:21:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-35885</guid>
		<description>Nice tutorial and great code. Thx for it.</description>
		<content:encoded><![CDATA[<p>Nice tutorial and great code. Thx for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Offshore c sharp net programmer</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-35870</link>
		<dc:creator>Offshore c sharp net programmer</dc:creator>
		<pubDate>Mon, 31 May 2010 05:46:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-35870</guid>
		<description>Great job dude. The code is working...Thanks a lot for it!</description>
		<content:encoded><![CDATA[<p>Great job dude. The code is working&#8230;Thanks a lot for it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Najmanowicz</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-33566</link>
		<dc:creator>Adam Najmanowicz</dc:creator>
		<pubDate>Tue, 06 Apr 2010 08:59:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-33566</guid>
		<description>hi reboltutorial, 
I wonder if you could provide me with some URL&#039;s to the sites. 
Preferably email as the spam filter will cut you off if you try to put them here .</description>
		<content:encoded><![CDATA[<p>hi reboltutorial,<br />
I wonder if you could provide me with some URL&#8217;s to the sites.<br />
Preferably email as the spam filter will cut you off if you try to put them here .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: reboltutorial</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-33158</link>
		<dc:creator>reboltutorial</dc:creator>
		<pubDate>Sun, 28 Mar 2010 22:06:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-33158</guid>
		<description>Hello,

Great code, it&#039;s working on many sites but on mine only the left part is rendered, do you know why ? Thanks.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>Great code, it&#8217;s working on many sites but on mine only the left part is rendered, do you know why ? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zeltera</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-31111</link>
		<dc:creator>zeltera</dc:creator>
		<pubDate>Tue, 09 Feb 2010 22:26:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-31111</guid>
		<description>I tried to create a thumbnail from yahoo.com and I got a blank page.</description>
		<content:encoded><![CDATA[<p>I tried to create a thumbnail from yahoo.com and I got a blank page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Najmanowicz</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-29639</link>
		<dc:creator>Adam Najmanowicz</dc:creator>
		<pubDate>Thu, 07 Jan 2010 22:54:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-29639</guid>
		<description>Hi Doris,

The application should be waiting before the browser reports that the page is finished loading. agreed that might not be enough if the loading is in a plugin&#039;s space. You can pretty easily modify the application to wait a certain timeout before taking the screenshot and after the browser reports loading completion.

If that is not something that you can do yourself (not being programmer maybe?) mail me and I will compile a custom version of the app for you. You can find my mail on the &quot;About me&quot; page.</description>
		<content:encoded><![CDATA[<p>Hi Doris,</p>
<p>The application should be waiting before the browser reports that the page is finished loading. agreed that might not be enough if the loading is in a plugin&#8217;s space. You can pretty easily modify the application to wait a certain timeout before taking the screenshot and after the browser reports loading completion.</p>
<p>If that is not something that you can do yourself (not being programmer maybe?) mail me and I will compile a custom version of the app for you. You can find my mail on the &#8220;About me&#8221; page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doris</title>
		<link>http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/comment-page-1/#comment-29633</link>
		<dc:creator>Doris</dc:creator>
		<pubDate>Thu, 07 Jan 2010 20:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2006/11/17/how-to-get-website-thumbnail-in-c/#comment-29633</guid>
		<description>It works well with some websites, but, for instance, it wouldn&#039;t take a snapshot of bing.com. Is there a way to allow the entire web page to finish loading and then take a snapshot? It would help with the sites containing flash or large images.</description>
		<content:encoded><![CDATA[<p>It works well with some websites, but, for instance, it wouldn&#8217;t take a snapshot of bing.com. Is there a way to allow the entire web page to finish loading and then take a snapshot? It would help with the sites containing flash or large images.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

