Hello friends,
I need to convert ASCII text to PDF on RHEL 6 so I did the below and could generate PDF but it has lot of junk/special characters.
yum install enscript ghostscript
enscript -p output.ps input.txt
ps2pdf output.ps output.pdf
So I download latest source of Ghostscript (ver 9.18) and I'm able to see ps2pdf and other commands that I got after installing from the source (after compiling/installing etc.). How can I generate PDF from these utilities (or how can I generate PS file from them so I can later run ps2pdf?)?
[root@lnxtst01 bin]# file *
dvipdf: POSIX shell script text executable
eps2eps: POSIX shell script text executable
font2c: POSIX shell script text executable
gpcl6: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
gs: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
gsbj: POSIX shell script text executable
gsdj: POSIX shell script text executable
gsdj500: POSIX shell script text executable
gslj: POSIX shell script text executable
gslp: POSIX shell script text executable
gsnd: POSIX shell script text executable
gxps: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
lprsetup.sh: POSIX shell script text executable
pdf2dsc: POSIX shell script text executable
pdf2ps: POSIX shell script text executable
pf2afm: POSIX shell script text executable
pfbtopfa: POSIX shell script text executable
pphs: POSIX shell script text executable
printafm: POSIX shell script text executable
ps2ascii: POSIX shell script text executable
ps2epsi: POSIX shell script text executable
ps2pdf: POSIX shell script text executable
ps2pdf12: POSIX shell script text executable
ps2pdf13: POSIX shell script text executable
ps2pdf14: POSIX shell script text executable
ps2pdfwr: POSIX shell script text executable
ps2ps: POSIX shell script text executable
ps2ps2: POSIX shell script text executable
unix-lpr.sh: POSIX shell script text executable
wftopfa: POSIX shell script text executable
[root@lnxtst01 bin]#
Please advise, many thanks!!
---------- Post updated at 12:31 PM ---------- Previous update was at 11:54 AM ----------
Further investigation shows that output PDF has many lines with special control characters like \033 (escape sequences) like below
\033&k2G\033(s12h10V
$ file input.txt
input.txt: ASCII English text, with escape sequences
So is there any possibility to remove those escape sequences from source text file OR using enscript
command itself (which I used to convert TXT to PS)