When you have a lot of text files to maintain, it's better to convert them into PDF documents. For example, PDFs are better for printing because PDF documents have predefined layouts. In addition, you can reduce the risk of accidental changes to your documents.
To convert a text file into PDF format, you will need to follow the two steps below.
Preparatory work
First, you need to install two required packages.
On Debian, Ubuntu, or Linux mint:
$ sudo apt-get install enscript Ghostscript
On Fedora, Centos/rhel:
$ sudo yum install enscript Ghostscript
On the Arch Linux:
$ sudo pacman-s enscript Ghostscript
Convert a text file into PDF format
After the preparation is complete, generate a PDF file from the text file in the following two steps
First, use the Enscript command-line tool to convert a text file into PostScript format.
$ enscript-p output.ps Input.txt
Finally, the PostScript format file is converted into a PDF file.
$ ps2pdf output.ps output.pdf
This article is from the "Baby God" blog, make sure to keep this source http://babyshen.blog.51cto.com/8405584/1586790
How to convert a text file to PDF on Linux