Skip to content
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

Slow Printing (Line by line) when printing each item from listbox #280

Open
jasikpl123 opened this issue Sep 20, 2024 · 1 comment
Open

Comments

@jasikpl123
Copy link

Hey,
i've noticed an "issue" which definitely slows down printing receipt in my POS system.
The issue involves printing each item in listbox, here's a sample code:

` for (int i = 0; i < listBox1.Items.Count; i++)

 Program.printer.Write(ByteSplicer.Combine(


 e.PrintLine(listBox1.Items[i].ToString())


 ));`

I would be thankful for every help.
Cheers

@igorocampos
Copy link
Collaborator

Everytime the method Write is called, it will send the bytes to the printer, which will print accordingly.

If you don't want so many print commands sent out, you should not put printer.Write inside a for loop...

Instead, you could create a byte[] variable to hold first all the data you wish to print at once, and them after you have the variable holding all the needed data, call printer.Write just one time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants