Skip to content

Instantly share code, notes, and snippets.

@Alvarocda
Created July 13, 2020 15:16
Show Gist options
  • Save Alvarocda/c69c03064078e14a998aa9cc50501c7d to your computer and use it in GitHub Desktop.
Save Alvarocda/c69c03064078e14a998aa9cc50501c7d to your computer and use it in GitHub Desktop.
public class ComandosImpressora
{
public static byte FONT_24PX = (byte)0x01; //24����������
public static byte FONT_32PX = (byte)0x00;
public static byte FONT_24PX_UNDERLINE = (byte)0x81;
public static byte FONT_32PX_UNDERLINE = (byte)0x80;
public static byte FONT_48PX_HEIGHT = (byte)0x12;
public static byte FONT_48PX_HEIGHT_UNDERLINE = (byte)0x92;
public static byte FONT_48PX_WIDTH = (byte)0x21;
public static byte FONT_48PX_WIDTH_UNDERLINE = (byte)0xA1;
public static byte FONT_64PX_HEIGHT = (byte)0x10;
public static byte FONT_64PX_HEIGHT_UNDERLINE = (byte)0x90;
public static byte FONT_64PX_WIDTH = (byte)0x20;
public static byte FONT_64PX_WIDTH_UNDERLINE = (byte)0xA0;
public static byte FONT_64PX = (byte)0x30;
public static byte FONT_64PX_UNDERLINE = (byte)0xB0;
public static byte FONT_48PX = (byte)0x31;
public static byte FONT_48PX_UNDERLINE = (byte)0xB1;
public static byte Align_LEFT = (byte)0x30;
public static byte Align_CENTER = (byte)0x31;
public static byte Align_RIGHT = (byte)0x32;
public static int Leopard_Alinha_Esquerda = 0x00;
public static int Leopard_Alinha_Centro = 0x01;
public static int Leopard_Alinha_Right = 0x02;
public static byte LANGUAGE_ENGLISH = 0;
public static byte LANGUAGE_FRANCE = 1;
public static byte LANGUAGE_GERMANY = 2;
public static byte LANGUAGE_UK = 3;
public static byte LANGUAGE_DENMARK1 = 4;
public static byte LANGUAGE_SWEDEN = 5;
public static byte LANGUAGE_ITALY = 6;
public static byte LANGUAGE_SPAIN1 = 7;
public static byte LANGUAGE_NORWAY = 8;
public static byte LANGUAGE_DENMARK2 = 9;
public static byte LANGUAGE_SPAIN2 = 10;
public static byte LANGUAGE_PORTUGUESE = 11;
public static byte LANGUAGE_CHINESE = 48;
public static int TYPE_IMAGE = 2;
public static int TYPE_IDLE_TIME = 3;
public static int TYPE_POWEROFF_TIME = 4;
public static int TYPE_ALIGN_LEFT = 5;
public static int TYPE_ALIGN_CENTER = 6;
public static int TYPE_ALIGN_RIGHT = 7;
public static int TYPE_ALIGN_FONTMULTIPLE = 8;
// add decode and encode
public static byte B_SOF = (byte)0xc0;
public static byte B_EOF = (byte)0xc1;
public static byte B_TRANSFER = (byte)0x7D;
public static byte B_XOR = (byte)0x20;
public static byte B_ESC = (byte)0x1B;
//Comandos da Leopardo A8
public static byte HT = 0x9;
public static byte LF = 0x0A;
public static byte CR = 0x0D;
public static byte ESC = 0x1B;
public static byte DLE = 0x10;
public static byte GS = 0x1D;
public static byte FS = 0x1C;
public static byte STX = 0x02;
public static byte US = 0x1F;
public static byte CAN = 0x18;
public static byte CLR = 0x0C;
public static byte EOT = 0x04;
public static byte ESC_CHAR = 0x1B;
public static byte[] LINE_FEED = new byte[] { 0x0A };
public static byte[] CUT_PAPER = new byte[] { GS, 0x56, 0x00 };
public static byte[] INIT_PRINTER = new byte[] { ESC_CHAR, 0x40 };
public static byte[] SET_LINE_SPACE_24 = new byte[] { ESC_CHAR, 0x33, 24 };
public static byte[] SET_LINE_SPACE_30 = new byte[] { ESC_CHAR, 0x33, 30 };
public static byte[] INIT = { 27, 64 };
public static byte[] FEED_LINE = { 10 };
public static byte[] SELECT_FONT_A = { 27, 33, 0 };
public static byte[] HEADER_FONT = { 27, 33, 32 };
public static int ALIGN_LEFT = 0;
public static int ALIGN_CENTER = 1;
public static int ALIGN_RIGHT = 2;
public static int BARCODE_UPCA = 65;
public static int BARCODE_UPCE = 66;
public static int BARCODE_EAN13 = 67;
public static int BARCODE_EAN8 = 68;
public static int BARCODE_CODE39 = 69;
public static int BARCODE_ITF = 70;
public static int BARCODE_CODABAR = 71;
public static int BARCODE_CODE93 = 72;
public static int BARCODE_CODE128 = 73;
public static int BARCODE_PDF417 = 74;
public static int BARCODE_CODE128AUTO = 75;
public static int BARCODE_EAN128 = 76;
public static int HRI_NONE = 0;
public static int HRI_ABOVE = 1;
public static int HRI_BELOW = 2;
public static int HRI_BOTH = 3;
public static int PAGE_LEFT = 0;
public static int PAGE_BOTTOM = 1;
public static int PAGE_RIGHT = 2;
public static int PAGE_TOP = 3;
public static int FILL_WHITE = 0;
public static int FILL_BLACK = 1;
public static int FILL_INVERTED = 2;
public static int SETTINGS_BLUETOOTH = 5;
//Convert ASCII/Decimal
public static string ESCQ = Convert.ToString((char)27);
public static string GSQ = Convert.ToString((char)29);
public static string center = ESCQ + "a" + (char)1; //align center
public static string left = ESCQ + "a" + (char)0; //align left
public static string bold_on = ESCQ + "E" + (char)1; //turn on bold mode
public static string bold_off = ESCQ + "E" + (char)0; //turn off bold mode
public static string cut = ESCQ + "d" + (char)1 + GS + "V" + (char)66; //add 1 extra line before partial cut
public static string initp = ESCQ + (char)64; //initialize printer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment