i want to create a little image containing a logo and multiple lines of text and send it directly to a printer. However im having trouble with textquality.
Currently im creating a Bitmap and render text to it via g.DrawString:
Bitmap bitmap = new Bitmap(240, 240);
Graphics g = Graphics.FromImage(bitmap);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; // or AntiAlias
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawString("Charge: 1911", new Font("Arial Narrow", 8.0F, System.Drawing.FontStyle.Regular), Brushes.Black, new PointF(6,119));
PrintDocument pd = new PrintDocument();
[...]
pd.PrintPage += PrintPage;
pd.Print();
g.Dispose();
This Code works so far as expected, except the textquality is too bad to actually print.
This is the current result:
with AntiAliasGridFit:
With AntiAlias:
This (or better) is the result that i want to achieve:
Now my question is, is there any way to get better textquality, maybe somehow using TextRenderer instead of Graphics? It doesnt have to be a bitmap that I print. I just need to be able to also write a pre-existing image to it and send the whole document to a Printer afterwards.