-
Notifications
You must be signed in to change notification settings - Fork 280
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
Tabbed text #635
Comments
@tmblog what was the steps to configure and test the printer on windows? could you help me please? |
I have the same question. I tried with set align, but that doesn't seem to do the trick when applied to the same line |
Hi and thanks for your question! The way Epson ESC/POS handles horizontal tabs (HT) is:
In python-escpos we do the above using the methods:
So to get the following output (imagine underscores are spaces): tabbed________text________8 You write: p.control("HT", count=2, tab_size=8) # handle 2 tabs of 8 characters size
p.text("tabbed")
p.text("\t") # TAB nº1
p.text("text")
p.text("\t") # TAB nº2
p.text("8")
p.ln() # carriage return Hope this helps. |
That's great thank you! |
Hello I used the default printer without the pid and vid.
And so on |
It depends. On the other had, the only way to know the "end" of the paper is to know the number of columns of the printer, but that value changes between models and also by the choice of the printer font (A or B), and other settings. You can access the capabilities data of a printer by passing the import escpos.printer as printer
p = printer.Dummy(profile="TM-T20II")
print(p.profile.profile_data)
n_cols = p.profile.get_columns(font="a") You can then use this data to position the text with the help of tabs or other methods. |
Hi thank you for your help!
|
Hello! Your question reminded me of issue #27, our oldest open issue, a few days ago. This inspired me to write a fix for this fairly common need and I hope to be ready to open a draft pull request in a few days. My approach is to add a helper method that organizes a list of strings into columns of the same width. The main problem I'm facing is what to do when a string exceeds the column width. I have a few approaches in mind, but I have yet to explore them. Greetings and stay tuned. ;-) |
I have:
Cannot get tabbed text. It stays on the left I am trying achieve item left price right. But I wanted to see how the tab works first but I can't get it to go the the right. Any pointers would be highly appreciated.
Thank you
This prints left aligned - what am I missing?
Device info
Printer is Aures ODP 333 (it supports esc/pos HT command)
python-escpos version: 3.1
python version: 3.12.1
operating system: Windows 11
The text was updated successfully, but these errors were encountered: