Search code examples
linuxmacosenscript

How to change text color in output from enscript


I am am converting simple text file to PDF from command line on Mac using following code:

enscript -Bp '-' input.txt | pstopdf -i -o outfile.pdf

What I would like to do is that color my text/font in PDF file. I believe enscript has color options but I could not make it work. For example, how can I convert a text in input.txt into red fonts. Can anyone help? Thank you.


Solution

  • Here is a thread that has the answer.

    http://www.linuxquestions.org/questions/linux-software-2/use-of-special-escapes-with-enscript-164978/

    In short first define escape character as follow: -e~ (tilda is escape character in this case).

    Now, make sure that escape is in your input.txt file: ~color{1 0 0}This is a sentence in input file.

    When you run the command input file text should be colored in red.