note 40705 added to ref.printer
| From: | jason at matteson dot com | Date: | Thu, 11 Mar 2004 20:01:08 +0000 |
| Subject: | note 40705 added to ref.printer | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66681@lists.php.net to get a copy of this message | ||
You can print in XP. AND, you can print to a shared printer with XP. The drivers for the printer
MUST be installed on ther server as well as on the computer you wish to print with. Also, the
printer must be shared on the client computer.
I am using a Zebra LP2844 Thermal Barcode Printer in my application. I am running XP Pro,Apache
1.3.27, PHP 4.3+.
Here is a function I use in our churches checkin system. I use this to print directly to our
printer with out having to use any Javascript.
First, i give the function the name of the shared printer.
Second, I get the client computers host name. You could use just REMOTE_ADDR too I suppose.
Then I return a correctly formatted Windows path to the shared printer for the
function getPrinter($SharedPrinterName) {
global $REMOTE_ADDR;
$host = getHostByAddr($REMOTE_ADDR);
return "\\\\".$host."\\".$SharedPrinterName;
}
$handle = printer_open(getPrinter("Eltron"));
So, as long as you KNOW the computers are suppose to have a shared printer called
"Eltron", you're all set to start sending info to the printer with the other Printer
functions.
-j
----
Manual Page -- http://www.php.net/manual/en/ref.printer.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40705
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40705&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40705&report=yes
Search -- http://master.php.net/manage/user-notes.php