I am trying to allow users to print reports via our intranet. I have the php_printer extension installed and working properly, but i cannot connect to the printer. The printer is one shared over a network path \PRINTERSERVER\MAINPRINTER.
$print_list = printer_list(PRINTER_ENUM_LOCAL);
//having looked at what printer_list() returns, i know that this is the printer i want
$printer = $print_list[5]['NAME'];
echo "Opening printer...<br>";
if ( !$handle = printer_open($printer) ) {
die("Could not connect to the printer $printer!");
}
But it always fails. I've also tried entering the printer name exactly as it appears when returned from printer_list(), as well as with escaped slashes. This printer is set as the default printer in both php.ini and windows.
Also, since what I want to print is dynamically generated, can i simply use this? Are URL wrappers enabled for this function?
printer_write($handle, "http://path/to/file/i/want/to/print")