When the below code I m trying div to convert image geting error..plz help
protected void ExportToImage(object sender, EventArgs e)
{
//string text = hfImageData.UniqueID;
string base64 = Request.Form[hfImageData.UniqueID].Split(',')[1];
byte[] bytes = Convert.FromBase64String(base64);
Response.Clear();
Response.ContentType = "image/png";
Response.AddHeader("Content-Disposition", "attachment; filename=HTML.png");
Response.Buffer = true;
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite(bytes);
Bitmap bitmap = new Bitmap(1, 1);
Graphics graphics = Graphics.FromImage(bitmap);
Font font = new Font("Arial", 25, FontStyle.Regular, GraphicsUnit.Pixel);
int width = (int)graphics.MeasureString(base64, font).Width;
int height = (int)graphics.MeasureString(base64, font).Height;
bitmap = new Bitmap(bitmap, new Size(width, height));
graphics = Graphics.FromImage(bitmap);
string fileName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()) + ".jpg";
bitmap.Save(Server.MapPath("~/images/") + fileName, ImageFormat.Jpeg); // hear i m getting error
Response.End();
}