laxplayin24 Posted July 17, 2006 Share Posted July 17, 2006 I am trying to print to a printer on my network. I have installed the php_printer.dll. But I am getting the following errors.Warning: printer_write(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 8Warning: printer_close(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 9Here is the code that I am using:[code]<?PHP$handle = printer_open("\\\\PRINT_SERVER\\PRINTER_NAME");printer_write($handle, "Text to print");printer_close($handle);?>[/code]Does anyone have any idea what the problem could be?Thanks for the help Link to comment https://forums.phpfreaks.com/topic/14852-printing/ Share on other sites More sharing options...
trq Posted July 17, 2006 Share Posted July 17, 2006 What does this produce?[code=php:0]$handle = printer_open("\\\\PRINT_SERVER\\PRINTER_NAME");if (is_resource($handle)) { echo "found printer";} else { echo "printer not found";}[/code] Link to comment https://forums.phpfreaks.com/topic/14852-printing/#findComment-59396 Share on other sites More sharing options...
wildteen88 Posted July 17, 2006 Share Posted July 17, 2006 I have not use the print_* functions but what appears to be the problem is where goto open a print connection with this:[code]$handle = printer_open("\\\\PRINT_SERVER\\PRINTER_NAME");[/code]Mainly the bit you define the printer in this bit \\\\PRINT_SERVER\\PRINTER_NAMEBasically the the called to the printer is failing as the address of the printer is incorrect Link to comment https://forums.phpfreaks.com/topic/14852-printing/#findComment-59398 Share on other sites More sharing options...
laxplayin24 Posted July 17, 2006 Author Share Posted July 17, 2006 I get printer not found.But if i put in a printer i know doesn't exist i get this error:Warning: printer_open() [function.printer-open]: couldn't connect to the printer [\\x335-printsrv\DPOPTRA] in c:\Inetpub\wwwroot\test2.php on line 6Warning: printer_write(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 8Warning: printer_close(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 9If i put one in that i know exists i only get: Warning: printer_write(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 8Warning: printer_close(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 9 Link to comment https://forums.phpfreaks.com/topic/14852-printing/#findComment-59400 Share on other sites More sharing options...
laxplayin24 Posted July 18, 2006 Author Share Posted July 18, 2006 anyone have any ideas about this? Link to comment https://forums.phpfreaks.com/topic/14852-printing/#findComment-59882 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.