Jump to content

server side printing


natbob

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.