views:

128

answers:

2

i've been googling for the last few hours now and can't seem to find an answer. but i did come close with
http://stackoverflow.com/questions/1648399/starting-serverside-print-job-via-php

Whole idea is I've got an intranet site on my windows server running xampp / wamp, I don't really want to give printing access rights to everyone as im stingy and only want the company printer being used for printing things off the intrant.

so i was after a way of printing intranet pages / documents stored locally on the server silently without the client machine phyiscally printing it.

I've found php_printer.dll on php.net but i read that it doesn't print html / documents only raw data (being plain text)?

anyone any ideas?

A: 

I would think that your 'best' option would probably be trying to find a way to interact with the printer driver (does the manufacturer provide anything useful?).

Otherwise you could try having a printMe function that adds the page URL to a db or something similar and then have a Scheduled task running a script every minute or so that prints any URLs that are listed. If you install firefox on your server you can then make it print without showing any prompts (use the Javascript window.print() function). Just make sure your scheduled task loads your script in firefox.

Using this method would also mean that you could log who printed what and when. You could also allow printing of places other than the intranet site (be sure to check that the URL is from the intranet regardless of whether you decide to allow printing from other sites) by creating a bookmarklet.

Blair McMillan
+1  A: 

In the past I've output a PDF from HTML (look at pisa -- python library for handling this), and then used shell_exec() to print the PDF.

Not very glamorous, but it works. Also, this was on a linux server, so I'm not sure about the capabilities of command-line printing on a Windows box.

Skone