note 46070 deleted from ref.printer by sobak

From: Date: Thu, 24 Nov 2016 20:30:11 +0000
Subject: note 46070 deleted from ref.printer by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207567@lists.php.net to get a copy of this message
Note Submitter: arne dot briesenick at soxabo dot de ---- 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 ;-)

« previous php.notes (#207567) next »