note 56296 added to ref.printer

From: Date: Tue, 30 Aug 2005 05:50:31 +0000
Subject: note 56296 added to ref.printer
Groups: php.notes 
Request: Send a blank email to php-notes+get-94362@lists.php.net to get a copy of this message
We can take the Un*X one a step further to allow for formating by using enscript. I didnt remake the wheel here, just a few changes are required. <?php function lpr($STR) { $CMDLINE="echo $STR | enscript -d DYMO -B -r --non-printable-format=caret --newline=r"; $pipe=popen("$CMDLINE" , 'w' ); if (!$pipe) {print "pipe failed."; return ""; } fputs($pipe,$STR); pclose($pipe); } // lpr() $STR="This is a test."; lpr ($STR); ?> Make sure the newline escape code is different from that of what echo would use or only the first line will be printed, if at all. ---- Manual Page -- http://www.php.net/manual/en/ref.printer.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56296 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56296&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56296&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56296&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56296&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56296&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56296&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56296&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94362) next »