Hi,
I am converting a text file to ps using enscript.
Does anyone know how to print in color?
Here is what I tried:
enscript -ptemp.ps -G -F Souvenir-DemiItalic20 -f Souvenir-DemiItalic20 -E --color file.txt
The color doesn't work
Thanks
Hi,
I am converting a text file to ps using enscript.
Does anyone know how to print in color?
Here is what I tried:
enscript -ptemp.ps -G -F Souvenir-DemiItalic20 -f Souvenir-DemiItalic20 -E --color file.txt
The color doesn't work
Thanks
You can't colorize arbitrary text file. You need text of some predefined language (/usr/share/enscript/hl/*) or insert color tags in your file or define your own output language.
Hi Yazu, thanks for the info
I tried this
enscript -ptemp.ps -G -F Souvenir-DemiItalic20 -f Souvenir-DemiItalic20 -E --color --language=html --output=file.txt file.txt
now it gives me the error message:
couldn't open AFM file for font "Souvenir-DemiItalic", using default
output left in file.txt
what am I doing wrong?
Hi was able to put some color in the file using a2ps
You can download a2ps from macports.
a2ps -R --column=1 --no-header --font-size=20 --pretty-print=js --highlight-level=heavy --pro=color --left-title=ITITLE1 --right-title=ITITLE2 -o temp.ps file.txt
_________________________________________________________________
Now this produces a file with only some of the words colored.
In order to make all the words colored I edited the js stylesheet.
Actually I created my own stylesheet and called it js2
You have to use awk ans sed commands to put the words from your file into the js2 file.
Here are the steps one by one.
sudo vi /opt/local/share/a2ps/sheets/js2.ssh
Next link the file to your real js2.ssh file in your working directory
ln -s /opt/local/share/a2ps/sheets/js2.ssh ./js2.ssh
Next write a script to create js2.ssh file in your working directory here is a copy of my own called makejs2
##########################################
echo '# Style sheet for JavaScript'
echo '# Copyright (C) 2011 walforum'
echo ''
echo '#'
echo '# This file is part of a2ps.'
echo '#'
echo '#'
echo ''
echo 'style JavaScript is'
echo 'written by "Forumbaba <walforum@unix.com>"'
echo 'version is 1.1'
echo 'requires a2ps version 4.12g'
echo ''
echo 'first alphabet is'
echo ' "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"'
echo 'second alphabet is'
echo ' "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"'
echo 'case sensitive'
echo ''
echo 'documentation is'
echo ' "Keywords are generated from a text file"'
echo 'end documentation'
echo ''
echo 'keywords in Keyword are'
sed "s/[^a-z|^A-Z]/ /g;" $1 | sed "s/in/ /g;" | sed "s/is/ /g;"| sed "s/are/ /g;" | sed "s/ARE/ /g;" | sed "s/by/ /g;" | sed "s/end/ /g;" | sed "s/written/ /g;" | sed "s/first/ /g;"| sed '/^ $/d' | sort -u | awk '{for(i=1;i<NF;i++)if(i%1==0){$i=$i","} }1' |awk '{ print " " $0 "," }'
echo ' love'
echo 'end keywords'
echo ''
echo 'keywords in Keyword_strong are'
sed "s/[^a-z|^A-Z]/ /g;" $1 | sed "s/in/ /g;" | sed "s/is/ /g;"| sed "s/are/ /g;" | sed "s/ARE/ /g;" | sed "s/by/ /g;" | sed "s/end/ /g;" | sed "s/written/ /g;" | sed "s/first/ /g;"| sed '/^ $/d' | sort -u | awk '{for(i=1;i<NF;i++)if(i%1==0){$i=$i","} }1' |awk '{ print " " $0 "," }'
echo ' Jesus, God, Heaven, Lord, Father, Blessed, sin '
#echo ' All, sin, break, "case", catch, class, continue, default, delete, do, else, enum, '
#echo ' export, extends, final, finally, for, goto, if, implements, import, '
#echo ' "in", instanceof, interface, native, new, package, private, protected, '
#echo ' public, return, static, super, switch, synchronized, throw, throws, '
#echo ' transient, try, typeof, var, volatile, while, with '
echo 'end keywords'
echo ''
echo 'operators are'
echo ' (/(function)([[:blank:]]+)([^ \t(]+)/'
echo ' \1 Keyword_strong, \2 Plain, \3 Label)'
echo 'end operators'
echo ''
echo 'optional operators are'
echo ' # Actual'
echo ' && \wedge,'
echo ' || \vee,'
echo ' <= \leq,'
echo ' >= \geq,'
echo ' ! \not,'
echo ' # Protected from the above'
echo ' <<<=,'
echo ' <<=,'
echo ' >>=,'
echo ' >>>=,'
echo ' !=,'
echo ' !=='
echo 'end operators'
echo ''
echo 'sequences are'
echo ' # Regular expressions'
echo ' (/(=)/ # \1 = assignment'
echo ' /([[:blank:]]+)/ # \2 = spaces'
echo ' /(\/)/ # \3 = "/"'
echo ' /([^\/])/ # \4 = first character of regexp'
echo ' \1 Plain, \2 Plain, \3 Plain, \4 String) String "/" Plain'
echo ' exceptions are'
echo ' "\\\\", "\\/"'
echo ' end exceptions,'
echo ' "/" Comment Comment "*/" Comment,'
echo ' "//" Comment,'
echo ' C-string,'
echo ' "'" Plain String "'" Plain'
echo ' exceptions are'
echo "\\\\", "\\'"
echo ' end exceptions'
echo 'end sequences'
echo 'end style'
############################################
This script is run by ./makejs2 file.txt > js2.ssh
That Should do it!!!!!!!!!!!!!
Enjoy
walforum
Sorry for the very late posting.
If you are using a Linux distribution look in /usr/share/doc/enscript (or possibly /usr/share/enscript-{ver} where {ver} is the version number. You will find a (possibly gzipped) file called README.ESCAPES. Use this to find out how to embed escape sequences into your text file to print in colour.
Andrew