PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am working to port over a set of Inkjet print request pages from an OS X based server to a Windows 2003 one. While I have worked out most of the bugs there are a couple that elude me. The main one that I would like help on is to fix the mechanism that automatically prints a sheet of paper with the request when it is submitted online.
//create new file
$ourFileName = "./uploads/order3800.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fwrite($ourFileHandle, $print_message);
//close file
fclose($ourFileHandle);
//systems calls to print and delete the file called "order"
system("lpr ./uploads/order3800.txt");
system("rm ./uploads/order3800.txt");
All the code seems to work fine on the Windows server except for the line that actually prints the file. I tried replacing "lpr" with "print" but I got the error "Unable to initialize device PRN". I googled this error and followed the instructions to map the networked printer to the DOS LP1 port but it did not work. Is there either a way to fix this or a better way to print using PHP?
Sends a print job to a network printer Usage: lpr -S server -P printer [-C class] [-J job] [-o option] [-x] [-d] filename Options: -S server Name or ipaddress of the host providing lpd service -P printer Name of the print queue -C class Job classification for use on the burst page -J job Job name to print on the burst page -o option Indicates type of the file (by default assumes a text file) Use "-o l" for binary (e.g. postscript) files -x Compatibility with SunOS 4.1.x and prior -d Send data file first
When I try to include a server the printer is hosted on like so
I replaced the IP with our Papercut server that the printer is hosted on, the printer with the queue name on that server, and the filename with the filename.