Hi, Does anyone have any experience how to code it so I can send a document (or a string) directly to a network printer from a Linux machine using php? Thanks, Stephan
OK I have managed to do it. Simply set up the printer on the server (installing drivers) and then use system('lpr document.doc'); PHP: works like a dream
Using system calls is generally poor practice; it is a blocking call for one thing and at the very least you shold be escaping the data you are passing into it (if it is selectable from the users, that is). There are plenty of other (better) ways to do this; using CUPS is pretty standard, through a SOAP request or such, or directly to a stream. You might also want to check the docs for the built in printer functions; NOTE: These are for windows machines and not unix as you have specified, but if you check the comments listed, there's at least 1 example of achieving it on a unix box. http://php.net/manual/en/ref.printer.php If you are happy using the system call, then so be it - just thought I'd add a comment about using it.