converting text to pdf
Table of Contents
Intro
I keep a store of some of my emails as PDFs which I later have print and bound. So, what to do when some of those emails are sent in plain text instead of pdf format? Convert to PDF so they can be bound uniformly.
From xmodulo1, there is a two-step process (after dependencies are acquired). Probably there’s a nifty way to do this in one-line, but I haven’t figured it out yet.
Step 0: Acquire dependencies
Needed are enscript
and ps2pdf
. They should be available from any linux repos.
Step 1: Convert the text to a PS file
enscript -p 2022310.ps 2022310.txt
Step 2: Convert the PS file to a pdf
ps2pdf 2022310.ps 2022310.pdf
Finé
Complete! This is one of the benefits of using a text-based email system: it is really simple to grab the text of an entire email message and save it to something amenable to this process. Similarly would be just printing the email as a PDF, which is also possible but doesn’t generalize as a solution no other things.
Footnotes
1 The most concise, least ad-filled answer for how to translate a text file to a pdf: https://www.xmodulo.com/convert-text-to-pdf-linux.html