Skip to content

Commit

Permalink
some changes for testing issues #2 and #3
Browse files Browse the repository at this point in the history
  • Loading branch information
mike42 committed Feb 15, 2015
1 parent 1a1e728 commit e047a5b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion escpos.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class escpos {
const LF = "\x0a";
const ESC = "\x1b";
const GS = "\x1d";
const FS = "\x1c";

/* Print mode constants */
const MODE_FONT_A = 0;
Expand Down Expand Up @@ -221,6 +222,13 @@ function barcode($content, $type = self::BARCODE_CODE39) {
* @param int $off_ms pulse OFF time, in milliseconds.
*/
function pulse($pin = 0, $on_ms = 120, $off_ms = 240) {
fwrite($this -> fp, self::ESC . "p" . chr($pin + 48) . chr($on_ms / 2) . chr($off_ms / 2));
// NOTE: http://www.easify.co.uk/support/epos_hardware_setup_guide/ suggests for the EPOS printer, the pulse command should be
// 27,112,0,25,30,27,116,2.
// ESC p 0 25 (50ms) 30 (60ms), ESC t 2
fwrite($this -> fp, self::ESC . "p" . chr($pin) . chr($on_ms / 2) . chr($off_ms / 2));
}

function image_nv_print_test($horiz_scale = 1, $vert_scale = 1) {
fwrite($this -> fp, self::FS . "p" . chr($horiz_scale) . chr($vert_scale));
}
}

0 comments on commit e047a5b

Please sign in to comment.