12

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.

3 Answers3

6

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.

Ron
  • 1,819
  • 19
  • 19
1

Best is to use http://iecapt.sourceforge.net/

Oak Bytes
  • 4,489
  • 4
  • 34
  • 52
Ravi Vanapalli
  • 9,489
  • 3
  • 30
  • 41
0

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
  • 994,864
  • 265
  • 3,241
  • 2,902