Convert text files to PDF

If you have brew Installed, you can install enscript and create a little batch file to do the conversion for you. From Terminal:

brew install enscript

After the magic, create a batch file

#!/bin/bash
enscript - -word-wrap -p  - "$1" | pstopdf  -i -o "$2"

Oh, meant to mention, those two dashes before word-wrap should be together, Discourse makes two dashes into an em dash —, so I added a space.

And save it to /usr/local/bin/txt2pdf

Then chmod +x /usr/local/bin/txt2pdf

Now you can just:

txt2pdf myfile.txt myfile.pdf
2 Likes