Skip to content

Instantly share code, notes, and snippets.

@Encang-Cutbray
Created May 20, 2020 16:59
Show Gist options
  • Save Encang-Cutbray/c846fd705466d112db4bb4b60e4dbbe4 to your computer and use it in GitHub Desktop.
Save Encang-Cutbray/c846fd705466d112db4bb4b60e4dbbe4 to your computer and use it in GitHub Desktop.
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";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment