Random Bits

Technical Log from Didik Setiawan

Convert Text to Pdf on Linux

Background: failed to build linux kernel documentation (still too lazy to solve problems).
Goal: generate pdf files of linux documentation, because I have reading problem when using text files. Text files look ugly when I open using my reader (Android).

Install needed packages.

$ sudo apt-get install enscript ps2pdf

Do this simple tricks.

$ cd Documentation/
$ for i in `ls -p | grep -v /` ; do ; enscript -p$i.ps $i ; done
$ for i in `ls *.ps` ; do ; ps2pdf $i ; done

Now I have pdf files of all the text files.
It still have a problem, it just convert files on the same directory. So other files under this directory must be processed separately, which mean I must move to each directory.

Comments