a light solution to convert text to pdf in Linux

linux, pdf

Solution

One way would be to use `enscript` followed by `ps2pdf`

enscript -p file.ps file.txt
ps2pdf file.ps file.pdf

Problem

I am looking for a light solution in linux, to literally convert a `*.txt` file into `pdf` format. I hope the solution satisfies: - lightweight. I know renaming `*.txt` to `*.odt` and then use `libreoffice` is a pathway, but it will load the heavy `libreoffice`. - I know `pr|groff -Tpdf` is a solution, yet it does not work literally: it throws away my line-breaks, an may accidentally eat some special marks as escaped labels, making potential bugs. But I still hope to use these old tools as much as possible, because they are stable and fast. Many thanks!

Original source