コード例 #1
0
        public void OpenDoor(string pDriver, string pPrinterName, int m, int t1, int t2)
        {
            try
            {
                ThermalPrinter printer = new ThermalPrinter("PC860");

                printer.WakeUp();

                printer.GeneratePulse(m, t1, t2);

                switch (pDriver)
                {
                case "THERMAL_PRINTER_WINDOWS":
                    //Impressora SINOCAN em ambiente Windows
                    //TK016310 Configuração Impressoras Windows
                    genericwindows.Print.USBPrintWindows(pPrinterName, printer.getByteArray());
                    break;

                case "THERMAL_PRINTER_LINUX":
                    //Impressora SINOCAN em ambiente Linux
                    genericlinux.Print.LinuxPrint(pPrinterName, printer.getByteArray());
                    break;

                case "THERMAL_PRINTER_SOCKET":
                    //Impressora SINOCAN em ambiente Linux Socket
                    genericsocket.Print.SocketPrint(pPrinterName, printer.getByteArray());
                    break;
                }
            }
            catch (Exception ex)
            {
                _log.Error("void OpenDoor(string pDriver, string pPrinterName, int m, int t1, int t2) :: " + ex.Message, ex);
            }
        }
コード例 #2
0
ファイル: PrintObject.cs プロジェクト: zeespogeira/logicPOS
        public void printTicket(DataTable dataLoop, DataTable dataStatic, string pDriver, string pPrinterName, string pathXml)
        {
            _log.Debug($"BO printTicket {pDriver}:pPrinterName{pPrinterName}");

            int coluneSize = 8;
            int LineSize   = 20;

            string strXml = string.Empty;

            XmlDocument xml = new XmlDocument();

            strXml = GetXmlString(pathXml);
            xml.LoadXml(strXml);


            //xml = replaceReservedStringsFromDatabase(dataProducts, xml.InnerXml);
            XmlDocument xmlDoc = replaceReservedStrings(xml.InnerXml);

            List <PrintObject> printobjects = Util.GetObjectsFromTemplate(this, xmlDoc, dataLoop, dataStatic);

            printobjects.Sort(); // sort by x coordinate

            List <PrintObject> printobjectsCalculate = Util.CalculatePrintCoordinates(printobjects, coluneSize, LineSize);

            ThermalPrinter printer = new ThermalPrinter("PC860");

            Util.PreparePrintDocument(ref printer, printobjectsCalculate, coluneSize, LineSize);

            switch (pDriver)
            {
            case "THERMAL_PRINTER_WINDOWS":
                //Impressora SINOCAN em ambiente Windows
                genericwindows.Print.WindowsPrint(pPrinterName, printer.getByteArray());
                break;

            case "THERMAL_PRINTER_LINUX":
                //Impressora SINOCAN em ambiente Linux
                genericlinux.Print.LinuxPrint(pPrinterName, printer.getByteArray());
                break;

            case "THERMAL_PRINTER_SOCKET":
                //Impressora SINOCAN em ambiente Linux Socket
                genericsocket.Print.SocketPrint(pPrinterName, printer.getByteArray());
                break;

            case "THERMAL_PRINTER_USB":
                //Impressora SINOCAN em ambiente USB
                genericusb.Print.USBPrint(pPrinterName, printer.getByteArray());
                break;
            }

            _log.Debug("EO printTicket");
        }