-
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Printer Stop before execution of cut command. #254
Comments
Hi there, have you tried to use Now if you want, I do have other suggestions regarding your code and totally unrelated to your issue: _printer.Write(PrintJob.PrintReceipt(_emitter));
_printer?.Write(_emitter.PartialCutAfterFeed(5)); Same goes for the following lines inside your Setup method printer?.Write(emitter.Initialize());
printer?.Write(emitter.Enable()); printer will never be null there, because those lines are inside 2 - Why Initialize and Enable the emitter every single time you print a receipt? In my opinion your Setup method should be called just once, from the constructor, just like you are doing with the initialization of your printer 3 - Also why instantiate a new emitter every time the button is clicked? You could have the emitter also instantiated just once (also in the constructor). 4 - Inside your StatusChanged method you have the following if (status == null)
{
Console.WriteLine("Status was null - unable to read status from printer.");
return;
} But then, after that you re-check over and over if status is 5 - I see you are creating a list of lists of bytes |
Some printers also allow you to overrun the buffer and they'll just throw away extra bytes, so if it's sending both copies back to back that might be part of the problem (especially since you're sending image data). Epson printers don't seem to have this problem as often, but if it's a 3rd party printer that might be what you're running into. The app tries to buffer the bytes and write them as the printer accepts them, so if the printer is properly applying back pressure and not accepting bytes until it's ready and has room in the buffer (the Epsons do this) then you can send as much data as you want to the library and it'll flush the bytes over time as the printer acknowledges the writes. This specifically applies to the serial port version which you're using and not necessarily all the other printer implementations. Have you tried sending the bytes more slowly? like put a Thread.Sleep(100) after each print command (this many sleeps isn't probably necessary in the long run but just to debug the issue) and a 1 second sleep between each prints? Also I'm not sure about the lifecycle of your app, if you are doing a test where you boot up the app, print 2 receipts and then quit the app, then it's also possible that you are just not getting the last prints flushed properly to the printer before the app quits - you have to ensure your app gives the print queue enough time to flush. This is covered in the readme as well. |
Hello,
My Problem is when I want print 2 receipt of same data. it prints first receipt and execute cut command but after printing second receipt it stop before executing cut command. meaning that it does not cut second receipt. Could you please reagrding this issue. Sample code is below:
Main Window File
PRINT JOB CLASS
Could you please guide about this ? Thank you
The text was updated successfully, but these errors were encountered: