lukevp / ESC-POS-.NET

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

Code128 Barcode not printing (again) ... #206

Open ctenov opened 1 year ago

ctenov commented 1 year ago

Hi Luke,

I know this was discussed in #31, #39 and #59 issues, but I think there is an error (again) on printing Barcode Code128 in version 3.0.0 applied on Windows C#. (If it does matter I am printing via Ethernet)

I did a little print of barcode 128 with original driver of printer Sweda SI300L and after that I printed a slight modification of your master sample of the library and you will see on the photo that Barcode 128 is not present when I used ESCPOS library.

I will paste below the code I used and the photo of print. Can you help me on this ?

Many Thanks

            var e = new EPSON();
            printer.WriteAsync( // or, if using and immediate printer, use await printer.WriteAsync
              ByteSplicer.Combine(
                e.CenterAlign(),
                e.PrintImage(File.ReadAllBytes("images/pd-logo-300.gif"), true),
                e.PrintLine(""),
                e.PrintLine("BARCODE ITF ON NEXT LINE"),
                e.SetBarcodeHeightInDots(360),
                e.SetBarWidth(BarWidth.Default),
                e.SetBarLabelPosition(BarLabelPrintPosition.None),
                e.PrintBarcode(BarcodeType.ITF, "0123456789"),
                e.PrintLine(""),
                e.PrintLine("BARCODE CODE128 ON NEXT LINE"),
                e.SetBarWidth(BarWidth.Default),
                e.PrintBarcode(BarcodeType.CODE128, "352203111111111111115"),
                e.PrintLine(""),
                e.PrintLine("B&H PHOTO & VIDEO"),
                e.PrintLine("420 NINTH AVE."),
                e.PrintLine("NEW YORK, NY 10001"),
                e.PrintLine("(212) 502-6380 - (800)947-9975"),
                e.SetStyles(PrintStyle.Underline),
                e.PrintLine("www.bhphotovideo.com"),
                e.SetStyles(PrintStyle.None),
                e.PrintLine(""),
                e.LeftAlign(),
                e.PrintLine("Order: 123456789        Date: 02/01/19"),
                e.PrintLine(""),
                e.PrintLine(""),
                e.SetStyles(PrintStyle.FontB),
                e.PrintLine("1   TRITON LOW-NOISE IN-LINE MICROPHONE PREAMP"),
                e.PrintLine("    TRFETHEAD/FETHEAD                        89.95         89.95"),
                e.PrintLine("----------------------------------------------------------------"),
                e.RightAlign(),
                e.PrintLine("SUBTOTAL         89.95"),
                e.PrintLine("Total Order:         89.95"),
                e.PrintLine("Total Payment:         89.95"),
                e.PrintLine(""),
                e.LeftAlign(),
                e.SetStyles(PrintStyle.Bold | PrintStyle.FontB),
                e.PrintLine("SOLD TO:                        SHIP TO:"),
                e.SetStyles(PrintStyle.FontB),
                e.PrintLine("  FIRSTN LASTNAME                 FIRSTN LASTNAME"),
                e.PrintLine("  123 FAKE ST.                    123 FAKE ST."),
                e.PrintLine("  DECATUR, IL 12345               DECATUR, IL 12345"),
                e.PrintLine("  (123)456-7890                   (123)456-7890"),
                e.PrintLine("  CUST: 87654321"),
                e.PrintLine(""),
                e.PrintLine(""),
                e.PartialCutAfterFeed(1)
              )
            );

Barcode128

igorocampos commented 1 year ago

Also reported at https://github.com/igorocampos/ESCPOS/issues/26

The problem was the length of the barcode data, if the barcode image is too large to be printed, the printer will just ignore it and not print the barcode.

@ctenov reported that the solution for him was to set the bar width to the thinnest possible (refer to command SetBarWidth). However he actually had to use the value 1 in the command which is currently not supported by this library enum, but there's a reason for that, EPSON's manual doesn't display 1 as an option for this command's parameter.

Another thing to keep in mind about the mentioned enum is that according to EPSON manual, the default value is not 4 as the enum states, but 3. image