mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
23 lines
634 B
PHP
23 lines
634 B
PHP
<?php
|
|
/* Change to the correct path if you copy this example! */
|
|
require_once(dirname(__FILE__) . "/../../Escpos.php");
|
|
|
|
/* Most printers are open on port 9100, so you just need to know the IP
|
|
* address of your receipt printer, and then fsockopen() it on that port.
|
|
*/
|
|
try {
|
|
$connector = null;
|
|
//$connector = new NetworkPrintConnector("10.x.x.x", 9100);
|
|
|
|
/* 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";
|
|
}
|
|
|