Re: Printing ASCII on Linux Server

From: Date: Fri, 06 Sep 2002 00:42:25 +0000
Subject: Re: Printing ASCII on Linux Server
Groups: php.general 
Request: Send a blank email to php-general+get-115377@lists.php.net to get a copy of this message
>Printing works fine, however 2 problems: > >1. linefeed ("\n") doesn't work > >2. escape sequences to print BOLD, ITALIC, UNDERLINE, >NARROW don't work Probably the same problem, really. > $lp = popen("lpr -Plp1", "w"); I'm guessing that popen uses the shell or something, and it's "eating" your control characters. Try things like: $print_string = "\"$print_string\""; > $bytes_written = fwrite($lp, $print_string); $print_string = str_replace("\n", "\\n", $print_string); > $bytes_written = fwrite($lp, $print_string); I suspect that something along those lines of convincing the shell to leave your data alone will fix your problems. It may also be a Good Idea to add: if ($bytes_written != ($strlen = strlen($print_string)){ die("Only wrote $bytes_written of $strlen characters"); } -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#115377) next »