Skip to content
Advertisement

a light solution to convert text to pdf in Linux [closed]

I am looking for a light solution in linux, to literally convert a *.txt file into pdf format. I hope the solution satisfies:

  1. lightweight. I know renaming *.txt to *.odt and then use libreoffice is a pathway, but it will load the heavy libreoffice.
  2. 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!

Advertisement

Answer

One way would be to use enscript followed by ps2pdf

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