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.
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)".
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With