mike42 / escpos-php

PHP library for printing to ESC/POS-compatible thermal and impact printers
Other
2.54k stars 862 forks source link

Cant print image > Print connector was not finalized. Did you forget to close the printer? #1021

Open rarassalsyabila opened 3 years ago

rarassalsyabila commented 3 years ago

I can't print image The error message show : A PHP Error was encountered Severity: User Notice

Message: Print connector was not finalized. Did you forget to close the printer?

Filename: PrintConnectors/WindowsPrintConnector.php

Line Number: 164

Here's the code

$connector = new Escpos\PrintConnectors\WindowsPrintConnector("EPSON TM-T88IV Receipt"); $printer = new Escpos\Printer($connector);

    $img = EscposImage::load("logo.png");
    $printer->bitImage($img);
    $printer->initialize();
edwinrosalesjuarez commented 3 years ago

You need to use the close method $printer ->close();