Can I send an ESC d command to a POS printer from perl?

I have a Star TSP100 printer and I have a few problems with it.

My problem is that I am not as familiar with programming as I should, but I'm learning!

The Star Printer Programmer's Guide says that if I send ESC d to the printer - this will activate the built-in cutter - which I would like to do a lot.

My problem is that I have no idea how to send an escape code, for example, from Perl - if possible.

I really appreciate any advice on this.

+3
source share
3 answers

- ; ( ) "\e" "\033". , , , , , print $fh "\ed".

+6

Printer:: Thermal CPAN

https://metacpan.org/pod/Printer::Thermal

$printer = Printer::Thermal->new(serial_device_path=$path);
$printer->write("\x1d" . 'd'); # \x1d is ESC
$printer->print;

BTW esc d

cutpaper,

$printer->cutpaper;
$printer->print;
0

Source: https://habr.com/ru/post/1748950/


All Articles