note 46070 added to ref.printer
| From: | arne dot briesenick at soxabo dot de | Date: | Tue, 28 Sep 2004 14:42:08 +0000 |
| Subject: | note 46070 added to ref.printer | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77525@lists.php.net to get a copy of this message | ||
Printing in UN*X is possible too:
<?php
function lpr($STR,$PRN) {
$prn=(isset($PRN) && strlen($PRN))?"$PRN":C_DEFAULTPRN ;
$CMDLINE="lpr -P $prn ";
$pipe=popen("$CMDLINE" , 'w' );
if (!$pipe) {print "pipe failed."; return ""; }
fputs($pipe,$STR);
pclose($pipe);
} // lpr()
?>
You pipe the stream/string/char/sign whatever to the system. In the example shown above you have to
add at least the string for printing in the function call. The second arg is a printer name which if
you don't set will be set to the C_DEFAULTPRN. This is a constant definition from an ini file.
Hope this will help to save a lot of time ;-)
----
Manual Page -- http://www.php.net/manual/en/ref.printer.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46070
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46070&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46070&report=yes
Search -- http://master.php.net/manage/user-notes.php