29
20
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.
Don't know if it fits your need, but with
a2ps -P file *.src
you can produce postscript files out of your source code. But the PS files need to be converted and combined afterwards. – mpy – 2013-05-29T11:32:11.837Using convert (http://linux.about.com/od/commands/l/blcmdl1_convert.htm, imagemagick) you should then be able to make one pdf from the ps files.
– SBI – 2013-05-29T11:37:56.050Can you comment, what you mean with "complete mess"? This (http://i.stack.imgur.com/LoRhv.png) looks not too bad to me, using
– mpy – 2013-05-30T14:53:56.973a2ps -1 --delegate=0 -l 100 --line-numbers=5 -P pdf
-- I added-l
for 100 chars per row to prevent some word wraps and line numbers, but that's only personal preference.For converting this project(4 non-empty non-hidden files each about a page long in non-hidden directories) to pdf I had about 5 pages of source code and 39 pages of gibberish.
– Bentley4 – 2013-05-30T19:10:07.987