How to equally separate items in a printable area

最后都变了- 提交于 2020-06-29 03:48:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!