mike42 / escpos-php

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

one large image convert two image and then cut #661

Open abdkaviani opened 6 years ago

abdkaviani commented 6 years ago

Hi again I work with Bixolon f312 and Citizen S2000 According to other issues, for printing large images, it is better split the images into smaller ... And this is my code:

$connector = new NetworkPrintConnector($printerIP, 9100); $printer = new Printer($connector); try { $tux = EscposImage::load($image_out, false);//about 600x900 $tux2 = EscposImage::load($image_out2, false);//about 600x800 $printer -> bitImage($tux);//or bitImageColumnFormat $printer -> bitImage($tux2);//or bitImageColumnFormat $printer -> cut(); $printer -> close(); } catch (Exception $e) { $success = 0; } //$printer -> cut(); //$printer -> close();

When I run above commands, images is printed and cut paper works but sometimes (Maybe every five or more times), images is printed but cut paper don't work and when i print again, images is printed and cut paper works!! It happens only above and no problem in small images with one line bitImage command. Is it better ($printer -> cut()) to be outside TRY, or what you say?

Thanks

abdkaviani commented 6 years ago

The problem has not occurred yet, When I put this line ($printer -> cut()) out of try-catch