Andy-H Posted June 1, 2011 Share Posted June 1, 2011 Hi, I have been searching all day but can't find a solution to this using PHP. Basically were developing a CRM at work and wish to be able to print letters remotely using PHP. We have a printer equipped with a network card and I want to be able to fire requests to a socket listener port and have it print template documents depending on the request. So far all I've found is something called Line Printing Terminal which apparently can be called from command line as far as I understand. My boss has currently had me code a VB.NET script with two browser windows and it refreshes every 30 seconds, gets a url from a div element in the page and prints the webpage but I don't like this way, I think it's a sloppy hack and wastes bandwidth. Like I say, ideally I would like to fire requests at a port via the printservers IP address but we could have the printer set as default on the server on which the printing script would run. Any help/advice or resources would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/238126-php-socket-to-print-to-networked-printer/ Share on other sites More sharing options...
requinix Posted June 1, 2011 Share Posted June 1, 2011 LPT is a completely different mechanism from networking. It won't work in your situation. There is a PHP extension that may work for you. It's mostly dead, but you can find a somewhat recent version of it on this page (search for "printer"). Otherwise your best bet would be to make the server open up whatever file to print in whatever application and make the application print it, though you'd have to determine what that program is. Some allow for printing right from a command line (eg, app.exe /print filename) and some (notably Office) can be scripted through COM. Quote Link to comment https://forums.phpfreaks.com/topic/238126-php-socket-to-print-to-networked-printer/#findComment-1223662 Share on other sites More sharing options...
Andy-H Posted June 1, 2011 Author Share Posted June 1, 2011 Thanks, never used COM but it looks really easy so could be on to a winner there, think I'll look for a command line solution like you suggested in work tomorrow and failing that fall back on COM. Thanks for the help, much appreciated Quote Link to comment https://forums.phpfreaks.com/topic/238126-php-socket-to-print-to-networked-printer/#findComment-1223673 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.