2
votes

There are 2 Issue I am facing using the POS Command

For POS Command, i am using dll downloaded from Nuget : PrinterUtility

PrinterUtility.EscPosEpsonCommands.EscPosEpson

1) Barcode Does not Print Alphanumeric Characters In this,

PrinterUtility.EscPosEpsonCommands.EscPosEpson obj = new PrinterUtility.EscPosEpsonCommands.EscPosEpson();

var ByteValue = PrintExtensions.AddBytes(ByteValue,obj.BarCode.Code128("454541234"));

It only accepts numeric value not alphanumeric, so i did in another way to generate barcode using below code, but barcode is not generated.

public byte[] BarcodeGenrate(string BarcodeNO)
        {
            string GS = "\u001D";
            string ESC = Convert.ToString((char)27);
            string COMMAND = "";
            COMMAND = GS + "h" + 50;//Set barcode height
            COMMAND += GS + "H" + 2; //Select print position of HRI characters: 
            COMMAND += GS + "f" + 1; //Select font for HRI characters:
            COMMAND += GS + "k" + 4 + BarcodeNO + 0; //Print barcode: (A) format, barcode system = CODE39
            var result = System.Text.Encoding.Unicode.GetBytes(COMMAND);
            return result;

        }

2) Cut Page : This is also not working

 public byte[] CutPage()
        {
            string GS = Convert.ToString((char)29);
            string ESC = Convert.ToString((char)27);
            string COMMAND = "";
            COMMAND = ESC + "@";
            COMMAND = GS + "V" + (char)1;
            var result = System.Text.Encoding.Unicode.GetBytes(COMMAND);
            return result;

        }

Kindly help me with ESC/POS Command to generate Barcode Code128 and CutPage Command

2

2 Answers

0
votes

One solution would be like the one shown below:

private byte[] CutPage() {
    List<byte> oby = new List<byte>();
    oby.Add(Convert.ToByte(Convert.ToChar(0X1D)));
    oby.Add(Convert.ToByte('V') 
    oby.Add((byte)66);
    oby.Add((byte)3);

    return oby.ToArray();
}
-1
votes
var BytesValue;
BytesValue = PrintExtensions.AddBytes(BytesValue, obj.BarCode.Code128("12345"));