2
0
forked from Wavyzz/dolibarr
Files
dolibarr-fork/htdocs/includes/mike42/escpos-php/example/interface/windows-usb.php
Laurent Destailleur 9f20779136 Revert "Update escpos-php"
This reverts commit 2f42a226d0.
2016-05-18 13:18:55 +02:00

33 lines
1.0 KiB
PHP

<?php
/* Change to the correct path if you copy this example! */
require_once(dirname(__FILE__) . "/../../Escpos.php");
/**
* Install the printer using USB printing support, and the "Generic / Text Only" driver,
* then share it (you can use a firewall so that it can only be seen locally).
*
* Use a WindowsPrintConnector with the share name to print.
*
* Troubleshooting: Fire up a command prompt, and ensure that (if your printer is shared as
* "Receipt Printer), the following commands work:
*
* echo "Hello World" > testfile
* copy testfile "\\%COMPUTERNAME%\Receipt Printer"
* del testfile
*/
try {
// Enter the share name for your USB printer here
$connector = null;
//$connector = new WindowsPrintConnector("Receipt Printer");
/* Print a "Hello world" receipt" */
$printer = new Escpos($connector);
$printer -> text("Hello World!\n");
$printer -> cut();
/* Close printer */
$printer -> close();
} catch(Exception $e) {
echo "Couldn't print to this printer: " . $e -> getMessage() . "\n";
}