#26346 [Com]: Cannot output to a shared printer

From: Date: Sun, 04 Apr 2004 21:12:31 +0000
Subject: #26346 [Com]: Cannot output to a shared printer
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-27021@lists.php.net to get a copy of this message
ID: 26346 Comment by: jasonm at reslife dot org Reported By: rich at dwell dot co dot uk Status: Open Bug Type: PECL related Operating System: Windows 2003 PHP Version: 4.3.4 New Comment: Don't know if it's a "bug" however.... I have been hearing a lot of talk about people not being able to print to a shared printer with the php_printer.dll extension and functions. I have been doing this for over a year with our churches WAMP checkin system I wrote. Everything works fine as long as you are in windows 2000. When you get to XP, you MUST belong to a domain and the WAMP box MUST be on the domain in order for things to work; therefore you must have some sort of in house domain controller. Also, all of the drivers for any shared printers MUST be on the WAMP box shared with the same name as the others. I have deduced that the php_printer.dll relies upon the WAMP box's Print Spooler; shut it down and no printing happens. With all that said, I must admit our configuration (Windows 2000 Pro, Apache 1.3.27, PHP 4.3.4, MySQL 4.0.13-nt) does seem to crash every Sunday (when there are about 17+ stations running the checkin system and printing; we check in over 800+ unique children in over 4 services). Could it be that we need to move to Windows 2000 Server Installation? All of the errors/crashes seem to point to a spooler overload (we could potentially have over 10 print jobs being called at any one time..maybe Win2k Pro limit of 10 connections is causing this?).... Any help or info would be greatly apprecited. Thanks! -j Previous Comments: ------------------------------------------------------------------------ [2004-02-06 18:29:51] basurto at canada dot com Work around: ------------ I was having the same problem I solve this problem with the following steps: 1. I add Novell client 2. Start nprinter in the machine that have the printer 3. Next I did not add the second parameter It looks like your code>>>printer_start_doc($handle, ""); my code>>>printer_start_doc($handle); 4. voila it works!! NOTE: ----- I already have Novell but if you don't have it you can test this in a share printer with Microsoft. I think there is a problem with the second parameter in a network printer. I hope this help you. Regards ------------------------------------------------------------------------ [2003-11-21 05:30:21] rich at dwell dot co dot uk Description: ------------ There is a problem with the php_printer.dll. Printing to a local printer is fine although I find that some of the options in printer_set_option do not seem to work. On any share network printer, however, PHP gives warning about not being able to allocate the print job and then terminates. I can in some cases work around this by outputing to a file and then calling the external program print.exe to print the file, but this is only useful for printers with there own proprietory language like label printers. Obviously this is not a rights issue as I am printing to the printer using print.exe which runs under IUSR privileges. Reproduce code: --------------- <?php $handle = printer_open("\\\\Warehouse\\whlaser"); printer_start_doc($handle, ""); printer_start_page($handle); $font = printer_create_font("Arial", 100, 50, PRINTER_FW_MEDIUM, false, false, false, 0); printer_select_font($handle, $font); printer_draw_text($handle, "PHP is simply cool", 400, 400); printer_delete_font($font); printer_end_page($handle); printer_end_doc($handle); printer_close($handle); ?> Expected result: ---------------- The network printer should output "PHP is simply cool" as it does on a locally connected printer. Actual result: -------------- Warning: couldn't allocate new print job in c:\inetpub\wwwroot\test\unused routines\print.php on line 4 Warning: couldn't start a new page in c:\inetpub\wwwroot\test\unused routines\print.php on line 5 Warning: couldn't end the page in c:\inetpub\wwwroot\test\unused routines\print.php on line 15 Fatal error: couldn't terminate print job in c:\inetpub\wwwroot\test\unused routines\print.php on line 17 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26346&edit=1

« previous php.pear.dev (#27021) next »