Last updated on July 24, 2020 by Dan Nanni
When you have a bunch of text documents to maintain, there are advantages in converting them into PDF format. For example, PDF is good for printing because PDF documents have pre-defined layout. Besides, with PDF format, there is less risk hat the documents are accidentally modified.
To convert a text file to PDF format, you can follow two-step procedures.
First, you need to install two prerequisite packages.
$ sudo apt-get install enscript ghostscript
$ sudo yum install enscript ghostscript
$ sudo pacman -S enscript ghostscript
Once all prerequisites are installed, follow these two steps to generate a PDF file from a text file.
First, convert a text file to Postscript format by using
enscript command-line tool.
$ enscript -p output.ps input.txt
Finally convert the generated postscript file to a PDF file.
$ ps2pdf output.ps output.pdf
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.