Amogh Natu

Amogh Natu

  • 1.5k
  • 700
  • 282.3k

A generic error occured in GDI+. Why is this exception being

May 12 2013 11:11 AM
I'm trying to convert HTML Text to a .bmp image. I'm using the following code for performing the operation.

Bitmap m_Bitmap = new Bitmap(400, 600);
PointF point = new PointF(0, 0);
SizeF maxSize = new System.Drawing.SizeF(500, 500);
 
HtmlRenderer.HtmlRender.Render(Graphics.FromImage(m_Bitmap), "<html><head></head><body><p>This is a sh***y html code</p><p>This is another html line</p></body>", point, maxSize);
 
m_Bitmap.Save(@"C:\Test.bmp");


"HtmlRenderer" is an external namespace that is being used here. However, I'm getting an exception at the "m_Bitmap.Save(@"C:\Test.bmp");" line that says : A generic error occured in GDI+.
 
I'm unable to understand why this exception is being raised when the same code is running perfectly in my colleague's system. 
 
Please help. Thanks a lot.


Answers (2)