问题
I'm writing a simple app in Android to print through a ESC/POS thermal printer. I need to equally divide the printable area among three different items so that they look justified. I am unable to find a way to print the same
am using these commands to feed into my printer https://reliance-escpos-commands.readthedocs.io/en/latest/layout.html
attaching an image for reference, any help or suggestion will be appreciated.
"Amount" to the left ":" in the center and "value" to the right
回答1:
You won't be able to easily specify it with an escape sequence.
For example, justification ESC a applies to the entire line, and cannot be specified separately for each part of the line.
Maybe you can try ESC $ for absolute horizontal positioning.
That way, the string from the beginning of the line and the middle ":" could easily be specified with the same number each time.
However, the numeric string at the right end of the line will need to be adjusted according to the number of digits.
I don't know if such detailed escape sequences can be specified on Android.
Please try it.
In the library you presented, this page.
Cursor Position Commands
Absolute Print Position - $1B $24
Relative Print Position - $1B $5C
来源:https://stackoverflow.com/questions/59593647/how-to-equally-separate-items-in-a-printable-area