Hello all!
I am having a very annoying problem with saving an image dynamically from database text. This code works fine on my dev box but not on the production server.
Here is a sample of what I'm trying to do:
private void SaveImage()
{
Bitmap objBmpImage = new Bitmap(300, 300);
int intWidth = 0;
int intHeight = 0;
// Create the Font object for the image text drawing.
Font objFont = new Font("Arial", 12, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
// Create a graphics object to measure the text's width and height.
Graphics objGraphics = Graphics.FromImage(objBmpImage);
// This is where the bitmap size is determined.
intWidth = 100;
intHeight = 100;
// Create the bmpImage again with the correct size for the text and font.
//objBmpImage = new Bitmap(objBmpImage, new Size(intWidth, intHeight));
// Add the colors to the new bitmap.
objGraphics = Graphics.FromImage(objBmpImage);
//bounding box
RectangleF rectf = new RectangleF(0, 0, 295, 295);
// Set Background color
objGraphics.Clear(Color.White);
objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
objGraphics.DrawString("Test", objFont, Brushes.Black, rectf);
objGraphics.Flush();
objBmpImage.Save(@"***SERVER PATH HERE****");
Response.Write("Image saved completed");
}
there server path has Network Service write permissio