label-printer icon indicating copy to clipboard operation
label-printer copied to clipboard

Error on Batch printing

Open Xelosy opened this issue 3 years ago • 0 comments

Discussed in https://github.com/php-aidc/label-printer/discussions/16

Originally posted by Xelosy July 20, 2022 Hi i get the following error on Batch Printing:

Fatal error: Uncaught ErrorException: fwrite(): send of 8192 bytes failed with errno=10035 A non-blocking socket operation could not be completed immediately. in C:\inetpub\wwwroot\Intranet\Label\vendor\php-aidc\label-printer\src\Connector\NetworkConnector.php:69 Stack trace: #0 C:\inetpub\wwwroot\Intranet\Label\vendor\php-aidc\label-printer\src\Connector\NetworkConnector.php(71): PhpAidc\LabelPrinter\Connector\NetworkConnector->flushErrors() #1 C:\inetpub\wwwroot\Intranet\Label\vendor\php-aidc\label-printer\src\Printer.php(40): PhpAidc\LabelPrinter\Connector\NetworkConnector->write('SIZE 50 mm,25 m...') #2 C:\inetpub\wwwroot\Intranet\Label\Label.php(466): PhpAidc\LabelPrinter\Printer->print(Object(PhpAidc\LabelPrinter\Label\Batch)) #3 {main} thrown in C:\inetpub\wwwroot\Intranet\Label\vendor\php-aidc\label-printer\src\Connector\NetworkConnector.php on line 69

My Code:

''' $batch= (new Batch()); foreach ($_POST as $key => $value) { $label = Label::create(Unit::MM(), 50, 25); //Unit, Width, Height $label->charset(Charset::UTF8()); $label->add(new Clear()); $label->add(new Raw("DENSITY " . $temp)); $label->add(Element::textLine(($xFactor * 10), ($yFactor * 10), $current, 'arial.TTF', 25)); // x, y , text, font, size ..... much more $label->add( some elements) ...... $batch->add($label); } $printer->print($batch); '''

Its working for a few labels and then the error message from above appears. Is there a problem how i create the label in the foreach loop?

Xelosy avatar Jul 26 '22 06:07 Xelosy