раньше, если бы я мог печатать, и теперь я не могу с php и mke42 - PullRequest
0 голосов
/ 01 ноября 2018

Я сделал программу несколько месяцев назад, и она работала правильно, но так как несколько дней назад у меня начался сбой и я поставил эту ошибку, как будто не мог найти общий принтер.

//class and initialization of the library mike42
<?php
require __DIR__ . '/../autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\EscposImage;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
class Orden_Trabajo
{

//method print 
public function print ticket(){
        try {
        //shared name printer
        $connector=new WindowsPrintConnector("EPSON_01");
        //set the connector
        $printer=new Printer($connector);
        $printer->setJustification(Printer::JUSTIFY_CENTER);
        $printer->setTextsize(4,3);
        $printer->text("Example");
        $printer->text("\n");            
        $printer->setTextsize(3,2);            
        $printer->text("Tickets");            
        $printer->text("\n\n");
        $printer->setJustification(Printer::JUSTIFY_RIGHT);
        $printer->setTextsize(1,1);
        $printer->text("Number: 1");
        $printer->text("\n");    
        $printer->setJustification(Printer::JUSTIFY_LEFT);        
        $printer->text("text");
        $printer->text("\n\n");
        $printer->setTextsize(2,2);            
        $printer->text("this is a test to verify the ticket text");            
        $printer->text("\n\n\n");                
        $printer->text("text");
        $printer->text("\n");            
        $printer->text("text");
        $printer->text("\n");
        $printer->text("text");
        $printer->text("\n");            
        $printer->text("text");
        $printer->text("\n\n");                
        $printer->text("text");
        $printer->text("\n");
        $printer->text("text");            
        $printer->text("\n\n");    
        $printer->text("text");    
        $printer->text("\n");                
        $printer->text("text");
        $printer->text("\n");                
        $printer->cut();
        $printer->close();
        }
        catch (Exception $e) {
        echo "Couldn't print to this printer: " . $e -> getMessage() . "\n";
        }
        }
}?>

//error            
Warning: copy(\Luis_Enrique\EPSON_01): failed to open stream: No 
such file or directory in C:\wamp\www\Check_Ticket\src\Mike42\Escpos\
PrintConnectors\WindowsPrintConnector.php on line 372


try resetting the computer to the date on which it started to fail and 
worked, but at the time of restart it returns to show the error.


I tried to print from the shared printer with cmd but I frame this error
cd c:/
echo "hello world" > testfile
print /D:"\\%COMPUTERNAME%\EPSON_01" testfile
error
the device can not be initialized \\Luis_Enrique\EPSON_01

the driver that I am using is this
EPSON TM-T20 ReceiptE4

Я вижу ошибку связи с общим принтером, ни драйвер или блокировка коммуникационных портов общего принтера.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...