Binary package “enscript” in ubuntu noble

converts text to Postscript, HTML or RTF with syntax highlighting

 GNU Enscript takes ASCII files (often source code) and converts them
 to PostScript, HTML or RTF. It can store generated output to a file
 or send it directly to the printer.
 .
 It is often used for its syntax highlighting, as it comes with rules
 for a wide range of programming languages. New rules can be added
 using an awk-like stateful scripting language.