I have a Star TSP100 printer and I'm having few problems with it really.
My problem is that I'm not as familiar with programming as I should be - but I'm learning!
The programmers reference for the Star printer says that if I send a ESC d to the printer - that will activate the built-in cutter - which I would like to do very much.
My problem is that I have no idea how to send an escape code like that from within Perl - if it's even possible.
I really appreciate any a开发者_JS百科dvice on this one.
Escape is just a character; it can be written (among other things) as "\e"
or "\033"
. So assuming you have a handle open to the printer device, all you need is to print $fh "\ed"
.
http://www.rhinocerus.net/forum/lang-clipper-visual-objects/600098-lowlevel-printing-esc-codes-sending-printer-vista.html#post2414259
It's written in Clipper but fairly easy to understand since it uses the standard Windows Printing API, callable in 99% of Win32 programming languages.b
You can use my module Printer::Thermal from 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 is used for print and feed lines
You can use the inbuilt function cutpaper to make things simpler
$printer->cutpaper;
$printer->print;
精彩评论