note 33032 deleted from function.printer-list by sobak
| From: | sobak@php.net | Date: | Thu, 24 Nov 2016 20:29:45 +0000 |
| Subject: | note 33032 deleted from function.printer-list by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207562@lists.php.net to get a copy of this message | ||
Note Submitter: saidyjade at hotmail dot com
----
You can still get the "NAME" of printers through the printer_list as only the array keys
"DESCRIPTION" and "COMMENT" crash and not the "NAME" key.
$list_printers = printer_list(PRINTER_ENUM_LOCAL |
PRINTER_ENUM_SHARED);
// get the name of the first returned printer
//(you can add array walk function to get all printer names if you wish.. but I am lazy)
$this_printer = $list_printers[0]["NAME"];
// open a connection to your printer
$my_printer = printer_open($this_printer);
.. blah blah
The output of var_dump (as an example)
var_dump( printer_list(PRINTER_ENUM_LOCAL | PRINTER_ENUM_SHARED) );
array(1) {
[0]=> array(3) {
["NAME"]=> string(14) "Canon BJC-4550"
["DESCRIPTION"]=> string(30) "Canon BJC-4550,Canon BJC-4550,"
["COMMENT"]=> string(0) "This is my funky printer!" } }
As you can see var_dump (under variable functions in the manual) shows and/or retrieves the corrent
information but if you try to place into a variable or read the variable it crashes either apache
using php4apache.dll or php when you the command line client or cgi.
So as long as you do not get the comment or description it will list your printers.