I have been tasked with figuring out how to get our zebra label printers(mostly the 420t models) to print over the network from calls in one of our PHP applications. I've come up with a couple of ideas but wanted to run it past people more knowledgeable than I am before I start down one path or the other.
Setup a machine to be a print server which has the zebra on USB as the default printer. I'd have to write some sort of print queue script or something to run on this machine.
Get a zebra printer with a network port and directly send print requests to it. I have seen a couple of other SO questions about it and it seems to require sending in the RAW over sockets. From the answers on these questions it seemed like there were some issues with doing this.
Send the print request via FTP somehow as mentioned in a few places.
Use either 1 or 2 with the LPR library.
What do you guys suggest?
I use intersively the second solution at work, ie using network enabled printers, and sending them (via cURL to the printers IP) data from a .prn file with my replacements.
The models we use are G4K20d.
Related
First of all, sorry for my English, I have been with this problem for quite a few days. I will comment on my situation: I am doing an online ordering system, where once an order is created the ticket printing is triggered. I have tried using Google Cloud Print, it prints but it takes a long time and it does not work as it should, I tried a library called mike42, it prints perfect but not from a website.
The system is in a hosting and I am using PHP together with slim 3, if any of you know how to solve this I would really appreciate it.
The result I want (to be more specific) is the following: The employed user logs on the web (system hosted in the hosting), goes to the orders menu, when he clicks on create the order, this function is executed and prints the ticket directly on the thermal printer connected to the local machine. The same works only if the web is on the local server, which is not what I want.
The title is clear and complete. Printing must take place in client side browser. Client may be connected to a cloud based accounting or purchase system and POS termal printer is connected through a USB port. Computer mat be a zero client with just a browser.
Well, PHP is a server side language, that means it has no communication with the hardware of the local machine.
I've already had to do similar work, and there are two possible solutions:
1- Install PHP on a machine connected to the printer directly, and then print, which is a little impracticable since the server would have to be physically on site.
2 - Generate an output in text formatted for the width of the print and use the window.print () javascript function to call up the print screen, and the user would just click on print.
When I needed it I ended up opting for the second alternative, and it worked well, it is a bit boring to get the print size right, but it worked well.
I'm trying to develop a way to pull a list of printers (names and IPs at least), from a Windows print server. I plan to use this info in an external PHP-driven status website, running on a Linux webserver, which talks to the printers individually via SNMP. The SNMP communication is already functional. I just need a way of dynamically generating the list of printers it talks to, instead of hard coding all of the IPs/DNS Hostnames.
The idea here is that I do this entirely without touching or changing the print server(s), printers, or the underlying webserver. The only thing under my control is a shared, non-administrative CPanel account.
My research so far has led me to three potential leads. I have next to no experience with any of them.
1) The PHP printer_list command, which is part of the PECL extension. At the moment our webserver does not have this extension installed, and I'd prefer not to make that request unless I know it will work for my purposes.
2) The lpstat Linux command, part of CUPS. I've tried using it per the man page and it seems to just sit there doing nothing. I don't know if this is because it's expecting a CUPS response which I figure it will not be getting from a Windows server, or if this might be a firewall issue.
3) SMB or WMI queries of some sort. I have no idea how to even begin with these.
I'd like to ask for a recommendation on where to start. This has been a very troubling project to research because 90% of search results are about people wanting to print. Another 8% are about people polling a local system for printer info. The rest are black magic and proprietary enterprise solutions.
Any insights are very much appreciated.
== Matt
I am using WMI effectively to fetch printer information over network using :
Select * FROM Win32_Printer
To begin:
1 - Run wbemtest from run window.
2 - Connect to any machine where you know printers are configured.
3 - There is query option, copy Select * FROM Win32_Printer
4 - Step 4 will return you table, click on Show MOF, it will provide you printer information. Viola, you are done.
5 - I have used C# ManagementObjectSearcher & ManagementObjectCollection and it is pretty straightforward and easy to use.
There are some pros and cons of using WMI. Read it online.
Im working on a project where i need to use POS printer to generate the reciept. The client asked for a new request where the paper need to be cut automatically when the print has been done.. so that if he needs to print 10 recipts at a time it cuts 10 times and makes some difference.
I am having to make a few assumptions here.
The POS printer is connected to the client computer, not the PHP
server.
This is an internal application supporting Windows based POS terminals.
With this said, there are several Serial/COM port plugins available. We currently use an ActiveX plugin at work, though I wont make any recommendations -- I don't know enough about the alternatives. This will need to be installed/approved by the client computer.
Find the Make/Model of your printer and find the control codes for cutting the paper. They should be listed in the back of the manual. You will need to program your PHP script to output the correct data/control codes to the plugin to send to the printer.
Just for the record, I am not a fan of this solution.
I am currently adding features to a PHP web application for a client. They require to be able to print some raw data to a ticket / thermal printer direct from the php which will be run on an internet browser from a self service kiosk.
The data needs to printed on the local kiosk's in built ticket printer.
From my preliminary research I understand that I must perform this task using javascript for any client side actions and wondered if anybody knew of any method or example function that will allow the printing of a string to a designated printer / com port which would bypass the printer dialog box?
Thanks in advance for any help
Alex
This plugin requires Java installed client-side, but after the first security prompt, this will do what you need (works with Linux, Mac, Windows, Solaris -- anything that can run Java desktop application)
https://github.com/qzind/tray
If it has to be cross browser and platform independent, stop right now and run. There is NOT way, and I mean NO way for Javascript to access information about printers, margins, paper size, and all the variables in printers. Even if your browser has some sort of fast print button, print using default settings and default printers, you have no idea the type of paper, the ink, the margins, etc, and you could be printing on A4 paper, or in the US, our legal size, 8.5" X 11.5".
Browsers, for security, do NOT give javascript any access to this information that is supplied to them by the Windows API and the printer drivers. The closest possible that I know of, is in small networks, where the variables are known, and configured using Internet Explorer's JScript or ActiveX. Short of this, your only other easy option is to write your own web browser/addon/plugin, or to modify one that will run on these platforms, that has this built in capability.
More info available here.
EDIT: Though if you really want to make your life simple, tell them to install Firefox, and check out this article for the simplest solution possible. Also, have you considered VBScript? It has this capability, I've seen it done before.
Not possible, at least not without some extra steps.
Without knowing more about the kiosk environment, you have three main options:
1). Install a Web service on the local kiosk. This Web service would manage printing and ultimately be the most extensible solution.
2). Create a plug-in for the print service. This would be uglier, and really tie you to a single browser solution forever.
3). Wrap the browser in custom code to allow external calls. Again, somewhat ugly, but since you're running a kiosk, you're likely to have some sort of custom/extensible wrapper anyway.
I am having a CRM (Customer Relationship Management Software) built on php and running it on localhost (windows XP system). This contains the list of my clients. I want to be able to call these clients directly from my CRM and keep a log of the same. (Call time, call duration and record the calls). For incoming calls, I should be able to link it to my CRM, display the client details and log the data.
I have a voice enabled 3G GSM Modem (with USB connector) which can be used for this purpose. From my search, I understand I would need to send AT commands from PHP to interact with the modem. But I am not able to move ahead as I am completely new to this. I have never done any device interfacing before this.
Can you help me to understand how can I go about solving the above issue? Any leads, resources in this direction will be of great help.
I wouldn't try to do this with pure PHP since then you would have to have PHP interface with the hardware through the webserver, which can be a pain, if it is manageable at all. There are (edit) three options in my view:
1: AKA the hard way:
Write a PHP extension in C that does what you want, but this would mean a lot of programming for a relative small task.
2: The eas[y/ier] way:
Find a program (Maybe Skype?) that can do voice communication with your modem and has an API or a CLI so you can make PHP run:
voiceprogram.exe --call=555-000-5555 --saveTo=client1_20113103_1200.mp3
This allows the application to do what it's good as and only use PHP as the controller. The resulting MP3 (or Wav, OGG, etc) can be saved back to the CRM.
3: Other options
If you are able to program in a different language that does communicate easily with your modem you can write some custom code that can be triggered by PHP (sockets/SOAP/CLI) and handles the call. When finished it can 'POST' the call information back to your PHP script.
The first 2 solutions only work when the CRM runs on localhost, if you plan on using this in a shared network environment complexity will go up. The last option, if done correctly, can be used in a shared environment.