[PHP] Printing ASCII on Linux Server

2002-09-02 Thread Mingshuo Lin

I am trying to printout some ASCII Text (using LPR,
script see below) to a IBM Proprinter compatible
dot-matrix printer, on a server running Linux.

Printing works fine, however 2 problems:

1. linefeed (\n) doesn't work

2. escape sequences to print BOLD, ITALIC, UNDERLINE,
NARROW don't work

Any help is appreciated!!

Thanks!
LM
--
?php
// 1. DEFINE ESCAPE SEQUENCES

$bold_on   = chr(27) . chr(69);
$bold_off  = chr(27) . chr(70);

$underline_on  = chr(27) . chr(45) . chr(49);
$underline_off = chr(27) . chr(45) . chr(48);

$wide_on   = chr(27) . chr(87) . chr(1);
$wide_off  = chr(27) . chr(87) . chr(0);

$narrow_on = chr(15);
$narrow_off= chr(18);

$formfeed  = chr(12);

$linefeed  = \n;


// 2. DEFINE PRINT STRING

$print_string  = ;
$print_string .= Line 1 . $linefeed;
$print_string .= Line 2 . $linefeed;
$print_string .= Line 3 . $linefeed;

$print_string .= $bold_on  . bold  .
$bold_off  . $linefeed;
$print_string .= $underline_on . underline .
$underline_off . $linefeed;
$print_string .= $wide_on  . wide  .
$wide_off  . $linefeed;
$print_string .= $narrow_on. narrow.
$narrow_off. $linefeed;



// 3. PRINT ON LINUX SERVER

$lp = popen(lpr -Plp1, w);
$bytes_written = fwrite($lp, $print_string);
pclose($lp);

?
---


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Printing ASCII on Linux Server

2002-09-02 Thread Chris Hewitt

Mingshuo Lin wrote:

I am trying to printout some ASCII Text (using LPR,
script see below) to a IBM Proprinter compatible
dot-matrix printer, on a server running Linux.

Printing works fine, however 2 problems:

1. linefeed (\n) doesn't work

2. escape sequences to print BOLD, ITALIC, UNDERLINE,
NARROW don't work

Does printing work properly when printing from a file (made up from your 
code here), not from php? If not then its a print setup problem not a 
php problem. I'd check out your printing setup and if its a print setup 
problem then check for any bugs/upgrades.

HTH
Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php