Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.