0

I have the following code, which I send after putting the printer in line mode, but it just prints the '51' after swallowing the [ESC]A

The command to change font is [ESC]A51

var hexValue = "1B"; // ESC char in HEX
var asciiValue = System.Convert.ToChar(System.Convert.ToUInt32(hexValue, 16));
var stringVal = new string(new char[] { asciiValue });
stringVal = stringVal + "A51"; // Smaller Font

data = Encoding.Default.GetBytes(stringVal + NewLine);

connection.Write(data);
Undo
  • 25,519
  • 37
  • 106
  • 129
Daniel O
  • 2,810
  • 3
  • 28
  • 35

1 Answers1

0

Need some correct codes to normalize the output to printer.

var stringVal = new string(new char[] { System.Convert.ToChar(0x1b) /* ESC */, 
                                        'A', 
                                        System.Convert.ToChar(51) });
data = Encoding.Default.GetBytes(stringVal + NewLine);

connection.Write(data);

EDIT

In this case A51 need attention. If 51 is string, using '5', '1', or a char, using System.Convert.ToChar(51), the command is different way to pass.

Jones
  • 1,480
  • 19
  • 34