tags:

views:

2220

answers:

3

Can anyone point me to some sample code in C# for converting an html table to image? I know how to convert text to image but i need to create an image of well formatted text. The whole text is formatted in html table.

A: 

Do you mean to convert HTML to Bitmap or PDF?

schar
A: 

Converting HTML to bitmap is difficult task. You will need first a rendering engine capable of handling HTML and optionally javascript and css (in case you want to support them). Using a WebBrowser control could be done but there might be better ways.

Darin Dimitrov
+1  A: 

You can use the WebBrowser.DrawToBitmap method. Here is an example. So what I would do is create a page dynamically with the table you want, and nothing but the table, then use the DrawToBitmap method to save it to an image file.

Ronnie