TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venkat S
NA
86
27k
how to solve a generic error occurred in gdi+.
Aug 19 2015 4:30 AM
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();
}
Reply
Answers (
1
)
Fill Dataset value into DataGridView cell in ADO.NET
Transaction in Entity Framework