lukevp / ESC-POS-.NET

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

Printer Prints Twice #213

Closed ChaseDDevelopment closed 1 year ago

ChaseDDevelopment commented 1 year ago

Hey there! I am running this package on .NET 6.0, on Ubuntu 22.04.

I initialize the printer object like so:

private FilePrinter printerObj = new FilePrinter(filePath: "/dev/usb/lp5");

followed by:

var e = new EPSON();

and Essentially the Example receipt from the readme.

My issue comes from the fact that sometimes the printer will print 2 copies of the receipt back to back from one button_click.

I have tried Flushing the printer immediately after the print command like so:

            printerObj.Write(GetReceipt());
            printerObj.Flush(printerObj, null);
            System.Threading.Thread.Sleep(5000);

Perhaps I am flushing it wrong (Do I need to pass in different parameters)? or if anyone knows why the receipt will print twice randomly. I am using an EPSON TM_T20III

lukevp commented 1 year ago

@ChaseDDevelopment Nothing about this library would cause it to print twice, and it's not necessary to manually flush the printer object. It autoflushes by default. Are you sure that the button click event isn't firing twice? That would be the most likely cause of this issue. Do you have a minimal reproducible version of this? I have a TM_T20II and I haven't ever seen a double print.

lukevp commented 1 year ago

Closed stale issue. Ping me if you get a chance to try this again.

luizfern12 commented 7 months ago

I have the same problem and i know for sure the print isn't being called twice by the frontend