0

Is there a simple way to generate a colored postscript file out of a text file with embedded terminal color codes?

I have a few text files with embedded xterm color code sequences like the following:

ESC[1;95m Zn n. 8 ESC[0m

and I would like to print those files with their colors as they appear on a xterm. I tried a2ps but without success. Of course, I could write a script, but I am afraid that taking care of all the possible colors could be not simple.

1 Answers1

0

This is doable but it's a nontrivial amount of work in PostScript IMO. Probably a simpler approach would be to use awk or something to transform the color codes to something with more available tools, like html tags or markdown or something.

If you insist on doing it in PostScript, definitely read the Green Book, and Thinking in PostScript, both by Glenn Reid. The prototype line printer emulator used in both of these books would be a good starting point.

luser droog
  • 18,988
  • 3
  • 53
  • 105