lukevp / ESC-POS-.NET

Efficient, Easy to Use Thermal Printing & POS (Windows/Linux/OSX, WiFi/BT/USB/Ethernet)
MIT License
534 stars 180 forks source link

Does not print. #180

Closed efrainburton13 closed 2 years ago

efrainburton13 commented 2 years ago

I am trying to print with an HTTPS request. But when it comes to the printing part. It prints once and doesn't print again.

`using (printer = new NetworkPrinter(settings: new NetworkPrinterSettings() { ConnectionString = $"{ip}:{networkPort}" })) { var e = new EPSON(); printer.Write( ByteSplicer.Combine(

                    e.CenterAlign(),
                    e.SetStyles(PrintStyle.Bold),
                    e.PrintLine(businessName.ToUpper()),
                    e.PrintLine(ruc.ToUpper()),
                    e.PrintLine(address.ToUpper()),
                    e.PrintLine(addressTwo.ToUpper()),
                    //e.PrintImage(File.ReadAllBytes(@"C:\Users\efrai\Downloads\53da3eccad4c7886684d879cffb17504 (1).png"), true, true),
                    e.PrintLine("Comprobante Auxiliar de Factura Electronica"),
                    e.PrintLine(""),
                    e.SetStyles(PrintStyle.None),
                    e.LeftAlign(),
                    e.PrintLine("------------------------------------------------"),
                    e.PrintLine("TIPO: FACTURA                  NUMERO: 000000000"),
                    e.PrintLine("------------------------------------------------"),
                    e.ResetLineSpacing(),
                    e.PrintLine($"FECHA: {date.Day}/{date.Month}/{date.Year}               HORA: {date.Hour}:{date.Minute}:{date.Second}"),
                    e.Print($"SUCURSAL: {branchOffice}      "),
                    e.PrintLine($"  Caja/Pto Fact: {pto}"),
                    e.PrintLine($"RECEPTOR: {receptor}"),
                    e.PrintLine($"Cliente: {name.ToUpper()}"),
                    e.PrintLine($"RUC: {rucRec.ToUpper()}"),
                    e.SetStyles(PrintStyle.Bold),
                    e.PrintLine($"------------------------------------------------"),
                    e.CenterAlign(),
                    e.PrintLine("FACTURA"),

                    e.LeftAlign(),
                    e.PrintLine("------------------------------------------------"),
                    e.SetStyles(PrintStyle.None),

                    e.SetStyles(PrintStyle.FontB | PrintStyle.Bold),
                    e.Print("\x0A" + $"Codigo   Descripcion \x0A" + "Cant.     UN     V.Unit.      Imp      V.Total\x0A"),
                    e.Print(listProduct),

                    e.LeftAlign(),
                    e.PrintLine(""),
                    e.PrintLine($"Cantidad Items {items}"),
                    e.PrintLine(""),
                    e.RightAlign(),
                    //e.PrintLine($"Total Neto        {json.GTot.DTotNeto}"),
                    //e.PrintLine($"Monto Exento       {totalMontoEx}"),
                    //e.PrintLine($"Monto Gravado      {json.GTot.DTotGravado}"),
                    //e.PrintLine($"Total Impuesto     {json.GTot.DTotItbms}"),
                    //e.PrintLine($"Descuento          {json.GTot.DTotDesc}"),
                    //e.PrintLine($"Total             {json.GTot.DVTot}"),
                    e.PrintLine(""),
                    e.PrintLine("Forma Pago                "),
                    e.Print(formaPago),
                    e.PrintLine(""),
                    e.LeftAlign(),
                    e.PrintLine(""),
                    e.PrintLine("        Desglose ITBMS"),
                    e.PrintLine("M. Base        %        Impuesto"),
                    e.Print(desglose),
                    /*e.PrintLine("           Desglose ISC"),
                    e.PrintLine(""),
                    e.PrintLine(""),
                    e.SetStyles(PrintStyle.Bold),
                    e.PrintLine("________________________________________________"),
                    e.SetStyles(PrintStyle.FontB),
                    e.CenterAlign(),
                    e.PrintLine("Autorizacion DGI: 201800000000000000000672 de 2022-10-25 016:23:40"),
                    e.PrintLine(""),
                    e.PrintLine("Consulte en htts://fe.dgi.mef.gob.pa/consulta usando el CUFE:"),
                    e.PrintLine("FE01200000000000029-29-29-56000020180713000000000199990126181720997"),
                    e.PrintLine("o escaneando el codigo QR"),
                    e.CenterAlign(),
                    e.PrintQRCode("htps://hypernovalabs.com/es/", TwoDimensionCodeType.QRCODE_MODEL2, Size2DCode.EXTRA, CorrectionLevel2DCode.PERCENT_30),
                    e.PrintLine(""),
                    e.SetStyles(PrintStyle.Bold | PrintStyle.FontB),
                    e.PrintLine("Seccion Para Informacion Libre Promocional"),
                    e.PrintLine(""),
                    e.PrintLine("Seccion para aceptacion (cuando aplique)"),*/
                    e.FeedLines(5),
                    e.FullCut()
                  )
                );
                Thread.Sleep(5000);`
efrainburton13 commented 2 years ago

When trying to print it only got it once and then it stalled. I downgraded the library version to 1.6.0 and it printed without problems.