-
Notifications
You must be signed in to change notification settings - Fork 862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add multiple printers at once code? #789
Comments
Is it possible to send a cut ticket to a two printers? for example for use in a restaurant: 1/2 ticket for the kitchen and the another 1/2 for the bar, splice the same ticket? |
There is no built-in for this, but it's easy enough to implement a PrintConnector which sends data to multiple printers. Do you think something like this would be useful in the library? <?php
namespace Mike42\Escpos\PrintConnectors;
/**
* Wrap multiple connectors up, to print to several printers at the same time.
*/
class MultiplePrintConnector implements PrintConnector {
private $connectors;
public function __construct(PrintConnector ...$connectors)
{
$this -> connectors = $connectors;
}
public function finalize()
{
foreach($this -> connectors as $connector) {
$connector -> finalize();
}
}
public function read($len)
{
// Cannot write
return false;
}
public function write($data)
{
foreach($this -> connectors as $connector) {
$connector -> write($data);
}
}
public function __destruct()
{
// Do nothing
}
} And then something like- <?php
require __DIR__ . '/vendor/autoload.php';
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
use Mike42\Escpos\PrintConnectors\MultiplePrintConnector;
use Mike42\Escpos\Printer;
$kitchenPrinter = new NetworkPrintConnector("10.1.2.3", 9100);
$barPrinter = new NetworkPrintConnector("192.168.2.3", 9100);
$connector = new MultiplePrintConnector($kitchenPrinter, $barPrinter);
$printer = new Printer($connector);
$printer -> text("Hello World\n");
$printer -> cut();
$printer -> close(); Error handling would be really sketchy here, better make sure that the chef doesn't switch off the kitchen printer :) |
Yes, Multiple Printers feature is really useful. Thank you for your help, i really appreciate your help in this matter. |
i have also implement multiple printer and its working good with same data. is there any way to send categories wise receipt print to multiple printers at once. |
did you manage to send the separate categories of data? I want to send category A to the Printer in the kitchen and category B to the Printer in the Bar, I think we have the same problem. |
is it possible ? how i can print simultaneously data on different printer for example i have invoice which contain of 3 orders and i want to send each order data to separate kitchen printer . |
Hello,
it's possible to use two printers to print the same copy via Ethernet (IP)?
example
Printer 1 $connector = new NetworkPrintConnector("192.168.1.10", 9100);
Printer 2 $connector2 = new NetworkPrintConnector("192.168.1.12", 9100);
Thank you i appreciate your help in advance.
The text was updated successfully, but these errors were encountered: