escpos-php
escpos-php copied to clipboard
Print connector was not finalized. Did you forget to close the printer?
Hello Dear
Please help me out here, When ever I try to execute print order function for testing purpose I am getting following Error
Print connector was not finalized. Did you forget to close the printer?
My Code is bellow (Laravel)
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
use Mike42\Escpos\Printer;
public function printorder()
{
// $connector = null;
$connector = new WindowsPrintConnector("Black Copper BC-85AC");
$printer = new Printer($connector);
try {
/* Print a "Hello world" receipt" */
$printer->text("Hello World!");
$printer->cut();
$printer->close();
} catch (Exception $e) {
echo "Couldn't print to this printer: " . $e -> getMessage();
}
}
Please help me out. Thank you. I am trying to fix it from 3 days