escpos-php
escpos-php copied to clipboard
Printer PDF via WindowsPrintConnector error text
Hello friends, I have been printing the pdf to pos epson and activate imagick everything until the library manipulates images and everything is fine but when I use the mike32 library and send it to print it comes out like the photo, when I send pure text it prints normally, some aid.
`require DIR . '/vendor/autoload.php'; use Mike42\Escpos\Printer; use Mike42\Escpos\ImagickEscposImage; use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
$pdf = DIR . '/doc.pdf'; $connector = new WindowsPrintConnector("EPSON TM-U220 Receipt"); $printer = new Printer($connector); try { $pages = ImagickEscposImage::loadPdf($pdf); foreach ($pages as $page) { $printer->bitImage($page); } $printer->cut(); } catch (Exception $e) { /* * loadPdf() throws exceptions if files or not found, or you don't have the * imagick extension to read PDF's */ echo $e->getMessage() . "\n"; } finally { $printer->close(); }`