0

I would like to convert html (for example, a table) to an image and save it as a .jpg file. And, if that table is displayed within a web page along with other elements, I only want to get that specific table and save it as an image.

Is this possible using asp.net?

thanks

RoastBeast
  • 1,059
  • 2
  • 22
  • 38
Adil Bhatty
  • 17,190
  • 34
  • 81
  • 118
  • possible duplicate of [Convert a HTML Control (Div or Table) to an image using C#](http://stackoverflow.com/questions/1972739/convert-a-html-control-div-or-table-to-an-image-using-c) – Aristos Jul 02 '10 at 13:03

3 Answers3

0

We have used http://iecapt.sourceforge.net/ to convert HTML to image. You can try it out. It is available for FREE.

or

ref

http://stackoverflow.com/questions/1972739/convert-a-html-control-div-or-table-to-an-image-using-c
Amit Soni
  • 3,216
  • 6
  • 31
  • 50
0

I think this is a rendering issue and completely depends upon what browser rendering your HTML.

But this the closest thing I could get you using GDI+ and WebBrowser control from CodeProject.

Let me know whether it helped you or not!

Regards.

Abdul Munim
  • 18,869
  • 8
  • 52
  • 61
-1
<%@ Page Language="c#"%> 
<%@ Import Namespace="System.Drawing.Imaging" %> 
<%@ Import Namespace="System.Drawing" %> 
<%@ Import Namespace="System.Drawing.Drawing2D" %> 

<script runat="server"> 
private void Page_Load(object sender, System.EventArgs e) {   
Bitmap bmp= new Bitmap(Server.MapPath(Request.QueryString["i"]));   
Graphics g=Graphics.FromImage(bmp);   
g.SmoothingMode = SmoothingMode.AntiAlias ;   
g.DrawString(Request.QueryString["t"],    
new Font("verdana",12),SystemBrushes.WindowText, 1, 1);   
Response.ContentType="image/jpeg";   
bmp.Save(Response.OutputStream, bmp.RawFormat) ; } 
</script>
Mark Davidson
  • 5,503
  • 5
  • 35
  • 54