I have a question that has been troubling me for at least 3 weeks now. I need to print some data to a printer using php. I have data saved into a $print_output
You have several options to print with PHP on Windows:
Because PHP 5.2.0 is outdated, it's quite hard to find compiled extension. You might try to drop in the php_printer extension for 5.2.8:
http://downloads.php.net/pierre/php_printer-cvs-20081215-5.2.8-nts-Win32.zip
Add to your php.ini:
extension=php_printer.dll
Recent version might be found at Pierre's download site: http://downloads.php.net/pierre/
An alternative solution is to use the windows command "print".
See http://technet.microsoft.com/en-us/library/cc772773%28v=ws.10%29.aspx
exec("print /d:\\192.168.1.33_4\\Printer_Office c:\accounting\report.txt);
$fp=pfsockopen("192.168.1.201",9100);
fputs($fp,$print_data);
fclose($fp);