Printing to a Zebra printer using a php aplication web
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Printing to a Zebra printer using a php aplication web
Hi Everyone!!
I have a web page with php and xajax, and I'm trying to generate a barcode, and send it to a Zebra printer. I have no problems with the barcode, the issue here is, how can I send this barcode to the Zebra printer.
In the client side, if I type lpr -Praw file.txt, it works. But how can I do the same in my php web page?
Is the printer connected to the server or the to clients? If it's the server you can just use shell_exec or similar. But if it's the client it's a little more tricky. You can Javascript's window.print() but if it's text you can't use Javascript, so I think you will need to put the text in a (i)frame and then do something like "top.frames.frameName.print()". The frame can be hidden on the page. Also, it will not actually print, but bring up a box where people will have to click Ok. If webpages could print themselves, it would be too annoying.
So all the clients are printer servers? Then it has nothing to do with php or web pages. You can send the job to their server, but I think you need something like - H $_SERVER['REMOTE_ADDR'] and -U $username and so on. I'd play with the command line and read man lpr and so on. If you can "mess" with the clients, it could be easier to just set up ssh keys to all of them so you can execute commands from the server. Then you could just shell_exec("ssh $hostname lpr -Praw <file_to_print").
I still feel this is relevant to the OPs question, but this is a browser applet that seems to do as described. Hope it will help some future Google searches:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.