Skip to content

Instantly share code, notes, and snippets.

@Encang-Cutbray
Created May 20, 2020 16:59
Show Gist options
  • Select an option

  • Save Encang-Cutbray/c846fd705466d112db4bb4b60e4dbbe4 to your computer and use it in GitHub Desktop.

Select an option

Save Encang-Cutbray/c846fd705466d112db4bb4b60e4dbbe4 to your computer and use it in GitHub Desktop.

Revisions

  1. Encang-Cutbray created this gist May 20, 2020.
    19 changes: 19 additions & 0 deletions print example Mike42\Escpos
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    require __DIR__ . '/vendor/autoload.php';

    use Mike42\Escpos\Printer;
    use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;

    try {
    $connector = null;
    $connector = new WindowsPrintConnector("xp-58");

    $printer = new Printer($connector);
    $printer->text('kopi');
    $printer->text("Hello World!\n");
    $printer->cut();

    $printer->close();
    return 'kopi';
    } catch (\Exception $e) {
    echo "Couldn't print to this printer: " . $e->getMessage() . "\n";
    }