4 thoughts on “escpos-php 1.5 released”

  1. Hi Mike,

    We have integrated below code in Laravel5 and working fine with Ubuntu 16 in our local machine but same code is not working on our staging server (qc.xyz.com). CentOS is on staging server.

    Sample code:

    use Mike42\Escpos\PrintConnectors\FilePrintConnector;
    use Mike42\Escpos\Printer;
    $connector = new FilePrintConnector(“/dev/usb/lp0”);
    $printer = new Printer($connector);
    $printer -> text(“Hello World!\n”);
    $printer -> cut();
    $printer -> close();

    Please help me for Lunux and Windows OS.

    Regards,
    Avinash

  2. @Aviansh – Unless your staging server is connected to the printer via USB, you might need to devise a networked printing setup.

    There is an FAQ in the repository which has some tips for Internet-based printing, but otherwise you need a long USB cable, a LAN printer, or a print server such as CUPS on the computer that has the actual printer connected to it.

  3. I’m trying to print from my computer which connected the printer directly (LPT1)
    But when I’m trying to print from the web page I get this error : “Warning: file_put_contents(LPT1): failed to open stream: Permission denied in C:\xampp\htdocs\POS\src\Mike42\Escpos\PrintConnectors\WindowsPrintConnector.php on line 384 Couldn’t print to this printer: Failed to write file to printer at LPT1 ”
    i try to use this code
    require __DIR__ . ‘../autoload.php’;
    use Mike42\Escpos\Printer;
    use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;

    try {
    $connector = new WindowsPrintConnector(“LPT1”);

    $printer = new Printer($connector);
    $printer -> text(“Hello World!\n”);
    $printer -> cut();

    $printer -> close();
    } catch (Exception $e) {
    echo “Couldn’t print to this printer: ” . $e -> getMessage() . “\n”;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *