Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Achieving MS Word print quality in C#

Tags:

c#

printing

I am writing a small application that prints some stickers to a special printer.

When I use MS Word to print some text to that printer (and to an XPS file), the result looks excellent. When I print from C# code with the Graphics object, the text appears to be over-pixelized or over-smoothed.

I tried the following hints, but none produced the same result as MS Word:

System.Drawing.Drawing2D.SmoothingMode.AntiAlias
System.Drawing.Text.TextRenderingHint.AntiAliasGridFit
System.Drawing.Text.TextRenderingHint.AntiAlias
System.Drawing.Text.TextRenderingHint.ClearTypeGridFit
InterpolationMode.NearestNeighbor
CompositingQuality.HighQuality

And some others.

Can you advice which hints are applied by MS Word, so I could create it programatically?

like image 754
Moshe Avatar asked Oct 26 '22 11:10

Moshe


1 Answers

I'm not familiar with the Graphics object, but I'm guessing you're sending a bitmap to the printer instead of text or vector graphics.

If so, increase the resolution/DPI of the image you're creating to approach that of the printer, or switch to a rich text (XPS) or vector-based format.

like image 140
Dolph Avatar answered Nov 11 '22 06:11

Dolph