note 56296 deleted from ref.printer by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 30 Aug 2005 10:14:25 +0000 |
| Subject: | note 56296 deleted from ref.printer by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94374@lists.php.net to get a copy of this message | ||
Note Submitter: nutenschleuder at yahoo dot com
----
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.