Jump to content

Archived

This topic is now archived and is closed to further replies.

laxplayin24

Printing

Recommended Posts

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:

[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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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_NAME

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.