i need to directly send to the printer a ticket
can someone help me please
This isn't a Phalcon specific question. You will have better luck asking on a more general purpose forum like www.stackoverflow.com.
In my personal experience though, sending a print job to a printer from PHP is pretty much impossible.
You can generate PDF or PostScript file and send it to printer (print-server). Usualy PDF file will generate and download to user on the site.
this is actually pretty easy with message queing instead of using cron/scheduling
https://blog.jachim.be/2013/11/controlling-a-receipt-printer-with-zeromq-and-php/
<?php /** * Receive a print request and print. */ $context = new ZMQContext(); $sub = $context->getSocket(ZMQ::SOCKET_SUB); $sub->setSockOpt(ZMQ::SOCKOPT_SUBSCRIBE, ''); $sub->connect('tcp://server:5566'); while (true) { $printJob = $sub->recv(); $html = file_get_contents($printJob); $file = get_temp_dir() . '/printJob_' . sha1($html) . '.html'; file_put_contents($file, $html); // https://windowsitpro.com/systems-management/how-can-i-print-usb-printer-command-prompt exec('print /d:LPT2: ' . $file); }
whether or not its a good idea is something a lot of people have discussed