Monday, July 3, 2017

Convert Text file into pdf on Linux command line

Create a small size pdf file from a text file

First install enscript on linux system.

Debian/Ubuntu
apt-get install enscript


CentOS/Fedora
yum install enscript


Command to convert text file into pdf
enscript -B /path/of/text-file.txt -o - | ps2pdf - "/path/of/output.pdf"

-B is for not printing header on top of the pdf pages