How do I get a list all the printer fonts in c#?
I've written a c# app that prints out a receipt on a Citizen Thermal Printer. This works fine but I have to print out the character 'G' in the printer font "control" to automatically print out the bitmap logo saved in the printer's flash memory.
E.g.
e.Graphics.DrawString ("G", new Font("Control", 15), Brushes.Black, 0, 0, new StringFormat());
However, this doesn't work. And if I experiment with some of the MSDN examples on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/_gdiplus_enumerating_installed_fonts_usecsharp.asp using the InstalledFontCollection the list it produces doesn't include any of the printer fonts available if I look at the drop down of fonts in, for example, Wordpad.
So my question is : how do I get the name of and use a printer font in my c# application? I thought maybe I'm not using the correct name or something which is how I came up with the idea of listing all the printer fonts which I can't do?
Thanks for your help.
--------------------------------
Regards: Alison
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>XFVYhwcPPUmrDJHOFOJbyQ==</Id>
In order to access the printer font, you will need to bypass the .NET
framework drawing libraries (i.e. GDI+) and use GDI.
When you come to print, you can get use the Graphics.GetHdc method to get
handle you can use with GDI. You then use GDI routines to select the
printer font and draw the character for the symbol you need to print. You
then call Graphics.ReleaseHdc to continue with the rest of the printing in
.NET.
Chris Marchal
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.