Create Images from Web Page
-
I would lke to generate an image based from my webpage. Only the top 150 pixels by 40. Is there a way to take the designated pixels and take a screen shot into an image? thanks
-
I would lke to generate an image based from my webpage. Only the top 150 pixels by 40. Is there a way to take the designated pixels and take a screen shot into an image? thanks
Bitmap bmp = new Bitmap(Server.MapPath("web.jpg")); Graphics g = Graphics.FromImage(bmp); g.SmoothingMode = SmoothingMode.AntiAlias; //set Name g.DrawString(this.txtName.Text, new Font("Arial", 14), SystemBrushes.WindowText, 110, 10); //set Title g.DrawString(this.txtTitle.Text, new Font("Arial", 8), SystemBrushes.WindowText, 115, 30); //set Address g.DrawString(this.txtAddress.Text, new Font("Arial", 8), SystemBrushes.WindowText, 115, 55); //set web URl g.DrawString(this.txtWebURL.Text, new Font("Arial", 8), SystemBrushes.WindowText, Convert.ToInt16(this.TextBox1.Text), Convert.ToInt16(this.TextBox2.Text)); Response.ContentType = "image/gif"; bmp.Save(Response.OutputStream, ImageFormat.Jpeg); I figured out how to make this file. How do I make this applicaion download this file instead of displaying it on the screen? Right now it renders the image but when I try to download it windows OS doesnt recognise it as an image.