How can I automatically convert all source code files in a folder (recursively) to a single PDF with syntax highlighting?

Posted by Bentley4 on Super User See other posts from Super User or by Bentley4
Published on 2013-05-29T10:55:54Z Indexed on 2013/06/27 4:24 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

I would like to convert source code of a few projects to one printable file to save on a usb and print out easily later. How can I do that?

Edit

First off I want to clarify that I only want to print the non-hidden files and directories(so no contents of .git e.g.).

To get a list of all non-hidden files in non-hidden directories in the current directory you can run the find . -type f ! -regex ".*/\..*" ! -name ".*" command as seen as the answer in this thread.

As suggested in that same thread I tried making a pdf file of the files by using the command find . -type f ! -regex ".*/\..*" ! -name ".*" ! -empty -print0 | xargs -0 a2ps -1 --delegate no -P pdf but unfortunately the resulting pdf file is a complete mess.

© Super User or respective owner

Related posts about linux

Related posts about pdf