Now there are a lot of software can convert text files to PDF files, in fact, in Linux, without the use of software can also be converted text text to PDF, just two easy steps, the following small series to give you the introduction of Linux text files to the PDF file method.
Question: I want to convert a plain text file into a PDF document. Is there a simple way to convert a text file to a PDF file under the Linux command line?
When you have a lot of text files to maintain, it's better to convert them to PDF documents. For example, PDFs are more suitable for printing because PDF documents have predefined layouts. In addition, you can reduce the risk of accidental modification of the document.
To convert a text file to PDF format, you should follow the two steps below.
Preparatory work
First, you need to install two 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 the 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
The above is Linux. The steps to convert a text file to a PDF are described here, and you need to use the command-line tools, and you can download the tools for conversion if you're not a very knowledgeable friend on the command line.