Auto cut on thermal printer (php)

Home / Uncategorized / Auto cut on thermal printer (php)

Question:
How can i perform auto cut on Epson TMT82 from PHP File? bellow is my config file.
Config :

$tmpdir = sys_get_temp_dir();
$file = tempnam($tmpdir, ‘ctk’);
$handle = fopen($file, ‘w’);
$condensed = Chr(27) . Chr(33) . Chr(4);
$bold1 = Chr(27) . Chr(69);
$bold0 = Chr(27) . Chr(70);
$initialized = chr(27) . chr(64);
$condensed1 = chr(15);
$condensed0 = chr(18);
$Data = $initialized;
$Data .= $condensed1;

for printing :

fwrite($handle, $Data);
fclose($handle);
copy($file, "//localhost/printer"); # printing
unlink($file)


Answer:
Try to write chr(29) + ‘V’ (or chr(86)), and then the values for m and n, depending on the exact function you want to use as per the manual below (if you just want to cut without feeding at all, you want to use function A, which means you can just follow with a 0 (or 48, not sure why they mentioned both numbers in the manual…!?), like so:
chr(29) . "V" . 0

https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=87

(you need to be logged on to read this reference, but registering is free)

Edited: the chr() code for ‘V’ is 86, not 56

Edit2: Just to comment on what Matt Gibson said; chr(27) . chr(105) should also work on your model (just checked, also chr(27) . chr(109)), but it’s an obsolete command, you should be using chr(29) . "V". In any case, some printers like to receive these sorts of commands on their own instead of having them along with the rest of the string.

Once you get this right, you should probably define a variable with the type of cut that you want. Ex. $cutPaper = chr(29) . "V" . 0;
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *