Jump to content


Photo

Printing


  • Please log in to reply
4 replies to this topic

#1 laxplayin24

laxplayin24
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 17 July 2006 - 02:19 PM

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 8

Warning: printer_close(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 9

Here is the code that I am using:

<?PHP
$handle = printer_open("\\\\PRINT_SERVER\\PRINTER_NAME");
printer_write($handle, "Text to print");
printer_close($handle);
?>

Does anyone have any idea what the problem could be?
Thanks for the help

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 July 2006 - 02:25 PM

What does this produce?

$handle = printer_open("\\\\PRINT_SERVER\\PRINTER_NAME");
if (is_resource($handle)) {
  echo "found printer";
} else {
  echo "printer not found";
}


#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 17 July 2006 - 02:26 PM

I have not use the print_* functions but what appears to be the problem is where goto open a print connection with this:
$handle = printer_open("\\\\PRINT_SERVER\\PRINTER_NAME");
Mainly the bit you define the printer in this bit \\\\PRINT_SERVER\\PRINTER_NAME

Basically the the called to the printer is failing as the address of the printer is incorrect

#4 laxplayin24

laxplayin24
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 17 July 2006 - 02:30 PM

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 6

Warning: printer_write(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 8

Warning: printer_close(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 9

If 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 8

Warning: printer_close(): supplied argument is not a valid Printer Handle resource in c:\Inetpub\wwwroot\test2.php on line 9

#5 laxplayin24

laxplayin24
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 18 July 2006 - 01:28 PM

anyone have any ideas about this?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users