saini
saini

Reputation:

Html table (text) to image using C#

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.

Upvotes: 12

Views: 9254

Answers (3)

Ravi Vanapalli
Ravi Vanapalli

Reputation: 9942

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

Upvotes: 1

Ron
Ron

Reputation: 1794

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.

Upvotes: 6

Darin Dimitrov
Darin Dimitrov

Reputation: 1038830

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.

Upvotes: 0

Related Questions