Page 1 of 1

getting the list of printers

Posted: Tue Oct 12, 2004 8:36 am
by pelegk2
how can i getthe list of printers on the server?
i it possible?
thnaks in advance
peleg

Posted: Tue Oct 12, 2004 8:39 am
by twigletmac
I'm guessing if it were possible then how you do it would be very much related to the type and version of server...

Mac

Posted: Tue Oct 12, 2004 9:21 am
by Weirdan
Are you talking about Windoze server?

Posted: Tue Oct 12, 2004 9:55 am
by pelegk2
nope i mean the apache is installed on windows and i wan the list of installed printers

Posted: Tue Oct 12, 2004 10:25 am
by Weirdan
http://www.php.net/manual/en/function.printer-list.php ?
That requires PECL printer extension though (which is only available from cvs).
On the other hand you may use some WinAPI wrapper to call EnumPrinters directly

can u tell me please where do i get the extension and how

Posted: Wed Oct 13, 2004 8:45 am
by pelegk2
to install it?

Posted: Thu Oct 14, 2004 3:47 am
by twigletmac
Google (RTFM & STFW).

Mac

Posted: Thu Oct 14, 2004 4:32 am
by pelegk2
i did the search Google (RTFM & STFW). and didnt find anything releavent to this :(

Posted: Thu Oct 14, 2004 4:35 am
by twigletmac
http://www.php.net/manual/en/ref.printer.php
PHP Manual wrote:Installation

This PECL extension is not bundled with PHP. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: http://pecl.php.net/package/printer.

Windows users will enable php_printer.dll inside of php.ini in order to use these functions. In PHP 4 this DLL resides in the extensions/ directory within the PHP Windows binaries download. You may download this PECL extensions DLL from the PHP Downloads page or at http://snaps.php.net/.
Mac

Posted: Thu Oct 14, 2004 6:38 am
by pelegk2
well i have the php_printer.dll and its un marked in the php.ini and still isnt working

Posted: Thu Oct 14, 2004 6:50 am
by patrikG
twigletmac wrote:http://www.php.net/manual/en/ref.printer.php
PHP Manual wrote:Installation

This PECL extension is not bundled with PHP. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: http://pecl.php.net/package/printer.

Windows users will enable php_printer.dll inside of php.ini in order to use these functions. In PHP 4 this DLL resides in the extensions/ directory within the PHP Windows binaries download. You may download this PECL extensions DLL from the PHP Downloads page or at http://snaps.php.net/.
Mac
The PHP manual would be the first port of call.

Posted: Thu Oct 14, 2004 9:41 am
by timvw
i'm using php5.0.2 on winxp pro (php_printer.dll is in %php%/ext)

around line 582 in php.ini i added

Code: Select all

extension=php_printer.dll
restarted apache and it works

Code: Select all

<?php
/* detect locally shared printer */
var_dump(printer_list(PRINTER_ENUM_LOCAL | PRINTER_ENUM_SHARED));
?>
array(1) { [0]=> array(3) { ["NAME"]=> string(16) "HP OfficeJet V45" ["DESCRIPTION"]=> string(34) "HP OfficeJet V45,HP OfficeJet V45," ["COMMENT"]=> string(0) "" } }

Posted: Thu Oct 14, 2004 10:13 am
by pelegk2
i have the same
maybe the diffrence in the php version?

Posted: Thu Oct 14, 2004 10:26 am
by pelegk2
well it worked on another computer but not on my - dont know why :(
but the intresting thing that it didnt get the share name only the original name as its defined!
any idea?

Posted: Fri Oct 15, 2004 1:27 pm
by Weirdan
I believe you'll be able to get share name if you pass the name of your local machine as second argument:

Code: Select all

var_dump(printer_list(PRINTER_ENUM_NAME, '\\\\\\\'' . $_ENV['COMPUTERNAME']));