natbob Posted July 21, 2008 Share Posted July 21, 2008 What would be a good way to print on a windows system from a php script? Link to comment https://forums.phpfreaks.com/topic/115899-server-side-printing/ Share on other sites More sharing options...
jonsjava Posted July 21, 2008 Share Posted July 21, 2008 had some fun printing a long config file trying to get an answer for you. Next time, I'll check the file size. Anyways, To print a file to a printer in windows, using PHP, you need to first save the file to a directory. This next part has only been tested on a network (I don't have a local printer): <?php $dir = "c:\\temp_folder\\"; // the folder that you are storing the file to be printed $file = "file.txt"; //change to proper file name $file_dir = $dir.$file; $server = "home_computer"; //name of the computer you are printing to on your network $printer = "HP"; //printers shared name $command = "print $file_dir /d:\\$server\\$printer"; exec($command) or die("File failed to print"); ?> oh, and you owe me some toner. *lol* just kidding. Link to comment https://forums.phpfreaks.com/topic/115899-server-side-printing/#findComment-595941 Share on other sites More sharing options...
kenrbnsn Posted July 21, 2008 Share Posted July 21, 2008 There are printing functions for Window included with PHP, see Windows only extensions -- Printer. I've never used them, so I can't say how well they work. Ken Link to comment https://forums.phpfreaks.com/topic/115899-server-side-printing/#findComment-595994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.