1: using (var masterGraphic = Graphics.FromImage(imageToRender))
2: {
3: masterGraphic.Clear(Color.White);
4: masterGraphic.SmoothingMode = SmoothingMode.AntiAlias;
5: //uncomment the following line if you just want the text drawn
6: //masterGraphic.DrawString(textToDraw, fontToDraw, colorBrushForText, new PointF(xCoordinate, startingPointForText.Y), formatOfText);
7: GraphicsPath pathOfText = new GraphicsPath();
8: pathOfText.AddString(textToDraw, fontCollection.Families[0], (int)FontStyle.Regular, fontSize, startingPointForText, formatOfText);
9: Pen outlinePen = new Pen(Color.Black, 2);
10: masterGraphic.DrawPath(outlinePen, pathOfText);
11: SolidBrush solidBrushForText = new SolidBrush(ColorTranslator.FromHtml("#567DB6"));
12: masterGraphic.FillPath(solidBrushForText, pathOfText);
13: DisposeObjects(new List<IDisposable>{pathOfText,formatOfText,colorBrushForText, solidBrushForText,outlinePen});
14: masterGraphic.Save();
15: }
16: WriteImageToResponse(context, imageToRender);