Reputation: 11
Im working on PHP based web application for booking. The guest room owner wants to use Black Copper BC-90AC thermal printer, which is USB printer for generating receipt. So I want to use mike42/escpos-php for the purpose. I have included the library into my project using composer install, however when I run a test page, I get following error.
Warning: copy(\DESKTOP-5O5GGB3\Receipt Printer): failed to open stream: No such file or directory in E:\xampp\htdocs\myproject\escpos-php\src\Mike42\Escpos\PrintConnectors\WindowsPrintConnector.php on line 378 Couldn't print to this printer: Failed to copy file to printer
Whether I connect thermal printer to my laptop or not, I get this error. Please suggest where Im doing wrong.
Here is the php example code which is giving me above error:
<?php
require_once __DIR__ . '/../../vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
try {
$connector = new WindowsPrintConnector("myprinter");
/* Print a "Hello world" receipt" */
$printer = new Printer($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";
}
Thanks for your suggestions in advance.
Upvotes: 0
Views: 2545