I have this Zebra ZM400 Printer connected to the network (192.168.1.50
). And I am trying to push a content to this printer directly from PHP.
This is the idea and I am just stuck without any way to do this. I tried the file_put_contents('192.168.1.50', $content)
but with no success.
Would appreciate if anyone could please help me in sorting out this. Thank you :-)
.................................................................................................................................
Solution:
I printed using the LPR Protocol. No need to install driver or anything. The LPR Printing Class for PHP 5 can be downloaded from here:
http://www.phpclasses.org/package/2540-PHP-Abstraction-for-printing-documents.html
I'm pretty sure just pushing text content over a socket will not work at all.
You will need to print over lpr is my guess. Install a print server like CUPS and you can send it using that...
I see you've gotten solutions using LPR and FTP, but I'm almost certain the Zebra printers will accept raw ZPL text on port 9100.
Later?...
If you have access to the serial port:
LINUX:
I have created a file in zebra language and used FTP to send the file many times in the past. just save the file and then create an ftp connection to the printer then use the put command to send the .txt file. the printer will do the rest
Take a look at these PHP printer functions
Note that
I had a similar issue where I was using a java program to print to a zebra printer without a print driver, and wanted to recreate this using PHP. It was bugging me that I couldn't find the answer. Through some packet capturing with Wireshark comparing the two, I felt that it was possible. I finally stumbled into the solution (at least for me). This will print a label to a networked Zebra printer directly from a PHP page without the need for a driver.