mtmsuhail / ESC-POS-USB-NET

This project is a simple .NET (C#) Implementation of the Epson ESC/POS Printing using USB Device Driver.
MIT License
201 stars 85 forks source link

ESC/POS Commands #23

Open dicksonkimeu opened 3 years ago

dicksonkimeu commented 3 years ago

How can i pass some commands to the printer ?

I.e

string ESC = "0x1B"; //ESC byte in hex notation string NewLine = "0x0A"; //LF byte in hex notation

    string cmds = ESC + "@"; //Initializes the printer (ESC @)
    cmds += ESC + "!" + "0x38"; //Emphasized + Double-height + Double-width mode selected (ESC ! (8 + 16 + 32)) 56 dec => 38 hex
    cmds += "BEST DEAL STORES"; //text to print
    cmds += NewLine + NewLine;
    cmds += ESC + "!" + "0x00"; //Character font A selected (ESC ! 0)
    cmds += "COOKIES                   5.00"; 
    cmds += NewLine;
    cmds += "MILK 65 Fl oz             3.78";
robocon commented 3 years ago

You can set to Byte(Array) like this

// https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=68 byte[] PartialCut = { 0x1B, 0x69 }; printer.Append(PartialCut); printer.PrintDocument();