Cash drawer open command

1

I'm trying to make a button that sends a command to open the cash drawer connected to the TP-650 Tanca printer. Below is the method I'm trying to do.

    public static void abrirGaveta(bool flag)
    {
        if (flag == true && Properties.Settings.Default.ImpressoraGaveta == 1)
        {
            //Metoto para abrir a gaveta


            const int charCode = 27;
            const int charCode2 = 251;
            const int charCode3 = 227;
            var specialChar = Convert.ToChar(charCode);
            var specialChar2 = Convert.ToChar(charCode2);
            var specialChar3 = Convert.ToChar(charCode3);
            string cmdText = "" + specialChar + specialChar2 +"22|" + specialChar3;

            string driver = "TANCA TP-650";
            string comandoAbertura = cmdText;
            RawPrinterHelper.SendStringToPrinter(driver, comandoAbertura);
        }
    }

There is no error, but it does not open the drawer either.

    
asked by anonymous 28.09.2018 / 15:02

1 answer

2

I was able to resolve it as follows:

            public static void abrirGaveta(bool flag)
    {
        if (flag == true && Properties.Settings.Default.ImpressoraGaveta == 1)
        {

            string driver = "TANCA TP-650";
            string comandoAbertura = "\u001bp
            public static void abrirGaveta(bool flag)
    {
        if (flag == true && Properties.Settings.Default.ImpressoraGaveta == 1)
        {

            string driver = "TANCA TP-650";
            string comandoAbertura = "\u001bp%pre%\nd";
            RawPrinterHelper.SendStringToPrinter(driver, comandoAbertura);
        }
    }
\nd"; RawPrinterHelper.SendStringToPrinter(driver, comandoAbertura); } }

The error was in the code (char) in the OpenItem variable.

    
28.09.2018 / 17:20