Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command line C++ to PDF converter with syntax highlighting? [closed]

I need to supply "Source code documents w/ Line numbers" which is essentially just a PDF of the source code with syntax highlighting and Line numbers. Is there any existing command line tools for windows that I could call from a script as a "build release version" script?

Right now I'm doing it manually using VC++, which isn't even the dev enviroment the code is for a TI processor, and a PDF printer driver, which has a pop up for each file I print.

like image 654
NoMoreZealots Avatar asked Apr 15 '10 22:04

NoMoreZealots


People also ask

How do I convert PDF to JPG in Linux?

Click the "Open File" option or use the "File → Open" menu to import the PDF into the software. Step 2. Next, click on "File → Export To → Image → JPEG (. jpg)".


1 Answers

Two syntax highlighters I use are enscript and source-highlight.

The first can output to PostScript (that you can convert to PDF using ps2pdf), the second produces output in HTML, LaTeX and other formats.

Both should be available via Cygwin

EDIT: On my system the following command will print all the cpp files in the current subtree.

find . -name "*.cpp" | xargs enscript -Ecpp -fCourier8 

While the following will produce a code.pdf file with the same content

find . -name "*.cpp" | xargs enscript -Ecpp -fCourier8 -o - | ps2pdf - code.pdf

PS: and give the --color=1 for color output and -C for line numbers.

find . -name "*.cpp" | xargs enscript --color=1 -C -Ecpp -fCourier8 -o - | ps2pdf - code.pdf
like image 100
baol Avatar answered Nov 10 '22 14:11

baol