Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw line with ESC/POS?

I need to draw a horizontal line (solid one but dashed will be perfect!) to my receipt using ESC/POS commands.

Now I'm using some hack that allow me to draw a horizontal line by using "UnderLine" command with some space characters, but i don't like it because i need to give the line some drawing properties like a "Height":

PRINT #1, CHR$(&H1B);"-";CHR$(1); <==== set underline on
PRINT #1, "            "; CHR$(&HA);
PRINT #1, CHR$(&H1B);"-";CHR$(0); <==== set underline off

I believe it can be happen with bit image commands but i have no idea how to do that.

Thanks in advance

like image 922
Top Systems Avatar asked Jan 23 '26 16:01

Top Systems


1 Answers

Using mike42's escpos-php:

$printer->textRaw(str_repeat(chr(196), 40).PHP_EOL);
like image 66
William Avatar answered Jan 25 '26 16:01

William



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!