Jump to content

Printing


laxplayin24

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
Link to comment
https://forums.phpfreaks.com/topic/14852-printing/
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
Link to comment
https://forums.phpfreaks.com/topic/14852-printing/#findComment-59398
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
Link to comment
https://forums.phpfreaks.com/topic/14852-printing/#findComment-59400
Share on other sites

Archived

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

×
×
  • Create New...

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.