ESC-POS-USB-NET
ESC-POS-USB-NET copied to clipboard
How to change font size?
I am not sure how to change the font size of the printer.
Hello, I know it's a little late but I wrote a simple extension class that achieve the font size setting (@mtmsuhail could be interesting to see this implemented)
public static class PrinterExtensions
{
[Flags]
public enum PrintStyle
{
HeightNormal = 0x00,
Height2X = 0x01,
Height3X = 0x02,
Height4X = 0x03,
Height5X = 0x04,
Height6X = 0x05,
Height7X = 0x06,
Height8X = 0x07,
WidthNormal = 0x00,
Width2X = 0x10,
Width3X = 0x20,
Width4X = 0x30,
Width5X = 0x40,
Width6X = 0x50,
Width7X = 0x60,
Width8X = 0x70,
};
public static void SetStyle(this Printer printer, PrintStyle style)
{
printer.Append(new byte[] { 0x1D, 0x21, (byte)style });
}
}
you can then use it like this:
Printer printer = new Printer("FooBar");
printer.SetStyle(PrintStyle.Height2X | PrintStyle.Width2X);