tags:

views:

336

answers:

5

Is there an API that can be used to generate thumbnails of a webpage in C#? I don't want to use third-party websites as I'd rather render them myself.

+1  A: 

There is a good article about using IE here: link

There is more information on this link to a previous SO

Development 4.0
+1  A: 

Here's an example of how to do it using GTK and Geko(Firefox) engine: http://tirania.org/blog/archive/2004/Jun-14.html

You should be able to do the same using Internet Explorer and WindowsForms if you prefer that.

LE: You do need to use an existing rendering engine like(Firefox's Geko, or Webkit, or Internet Explorer) instead of a html parser as this will allow you to capture the page as it is, with CSS, Flash, Java, etc

daniels
Re: Winforms and IE, It's been a long time since I've tried it (so they might've changed things) but it used to be you couldn't render a browser control to a bitmap.
Kennet Belenky
+4  A: 

There's a program on CodeProject that might fit the bill...it's a "console" app (really a hidden WinForms app) using the WebBrowser control.

I played around with it a while back and it works pretty well

Adam Neal
+1  A: 

I use WebShot's C# interface and the System.Graphics API to generate thumbnails.

Justin Haygood
+1  A: 

For a quick-and-dirty approach, you can instantiate an IE browser control and call the DrawToBitmap method. HOWEVER, this method is not strictly intended for public consumption. But it's accessible, and it does work. I wouldn't use it in production though.

James D