Printing without the Dialog
Tools you'll need:
1 local Unix or Linux server
1 PHP exec() call
PHP to format your data
First: your server MUST be a local server, on the same network as the printer. This is because we'll be using the lp command to shoot off the print job.
The actual command to start off the print job looks something like this:
The final ingredient of this system is to use PHP to format the data you need to print, and then save it to a file. The lpr command then works on that file.
lpr -p printer file.txt
In the end, we were able to get this whole thing working, but only because Dustin over at out co-location facility knew what needed to be done. Part of the command line printing involves manually creating a print spool - a task not for the faint of heart. The spool is defined in /etc/printcap, and looks something like this:
Shout outs to Dustin and Andrzej, for making the printing work, and for getting the scripts to call the print action.
by Dave Poole | 4/9/2007 4:36pm