Any text 2 pdf/ps

a2ps is a nice tool to convert anything text-like to postscript, but lacks the capability of detecting umlauts and special utf-8 characters. Beside that, generating a pdf is often more useful than a postscript file.

That's why I wrote two simple scripts to enhance the a2ps command. The trick is to use recode, a2ps, ps2pdf together:

INPUTFILE=test.txt
TMPFILE=/tmp/A2pdf_${INPUTFILE}
cp $INPUTFILE $TMPFILE
recode -f UTF-8..Latin-1 $TMPFILE
a2ps $TMPFILE -o $TMPFILE.ps -1 -X ISO-8859-1 --center-title=$INPUTFILE
ps2pdf -sPAPERSIZE=a4 -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite $TMPFILE.ps $OUTPUT
rm $TMPFILE
rm $TMPFILE.ps

This script also creates an a4 sheet with only a single text content window. Command-line call:

bash:~$ sh A2pdf.sh yourFile.txt

A file yourFile.txt.pdf is created in the same directory.

Section Blog: Available Downloads

 
filefile sizecomments
A2pdf.sh545 Bfeatured by this article
A2ps.sh445 Bfeatured by this article
XEmacs_quickref.pdf80 KBnone
auctex-ref.pdf96.25 KBnone
createIEEEPDF.sh622 Bnone
createWinVid.sh800 Bnone
ctags.zip241 Bnone
vpnclient-linux-2.6.19+-rev1.diff3.54 KBnone
Author: Christoph Hermes, published: So 1. Jul 14:45:34 2012