Sorry if this prints twice, I neglected to login prior to submitting this question. I think I stopped the previous post before posting.

Hello, I have been using the Term:ANSIColor module to print in color, but I would like to print this color on a printer. A simple redirect to the printer just prints the ANSI escape code. Could someone please let me know the best way to print color.

thanks
J

open(LPR, "|lpr -P agrprt165 >/dev/null 2>&1"); open TMP, ">.tmp"; $COLOR{"0"} = "black"; $COLOR{"1"} = "red"; $COLOR{"2"} = "yellow"; $COLOR{"3"} = "green"; $COLOR{"4"} = "blue"; $COLOR{"5"} = "cyan"; $COLOR{"6"} = "magenta"; $COLOR{"7"} = "white"; $ON_COLOR{"0"} = "on_black"; $ON_COLOR{"1"} = "on_red"; $ON_COLOR{"2"} = "on_yellow"; $ON_COLOR{"3"} = "on_green"; $ON_COLOR{"4"} = "on_blue"; $ON_COLOR{"5"} = "on_cyan"; $ON_COLOR{"6"} = "on_magenta"; $ON_COLOR{"7"} = "on_white"; $SPECIAL{"0"} = ""; $SPECIAL{"1"} = "dark"; $SPECIAL{"2"} = "bold"; $SPECIAL{"3"} = "underline"; $SPECIAL{"4"} = "underscore"; $SPECIAL{"5"} = "blink"; $SPECIAL{"6"} = "reverse"; $SPECIAL{"7"} = "concealed"; $SY{"0"} ="A"; $SY{"1"} ="B"; $SY{"2"} ="C"; $SY{"3"} ="D"; $SY{"4"} ="E"; for ($w=0; $w<8; $w++) { for ($x=0; $x<8; $x++) { for ($y=0; $y<4; $y++) { for ($z=0; $z<5; $z++) { $tmp = "$COLOR{$x} $ON_COLOR{$w} $SPECIAL{$y}"; print colored ("$SY{$z}", $tmp); print TMP colored ("$SY{$z}", $tmp); print LPR colored ("$SY{$z}", $tmp); } print "\n"; print TMP "\n"; print LPR "\n"; } } } close TMP; close(LPR);

edited: Tue Aug 5 17:30:58 2003 by jeffa - code tags, formatting


In reply to send color text to printer by jhasting

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.