Text to pdf

Is there a way to covert te attached text file to a pdf?

I have tried:

 enscript-p output.ps article.txt 

PRE.cjk { font-family: "WenQuanYi Micro Hei",monospace; }PRE.ctl { font-family: "Lohit Hindi",monospace; }P { margin-bottom: 0.08in; }

awk '{ A[$1]=$2; next} END { for (i in A) print "mv\x27"A"\x27",i".pdf" }' article.txt | sh

[/CODE]

Thank you :).

I dunno what you're doing exactly.

Linux and several other flavors have:
Consider using a2ps , and ps2pdf . Convert text to ps first with a2ps , then convert the output of that to pdf with ps2pdf .

Note: you may have ps2pdf13 or something like that. The "13" part refers to the version of pdf, in this example version 1.3 . You want the latest version, maybe 13 or 14.

I am not quite sure how to properly run the commands. I am just trying to take the article.txt which is a publication downloaded in text format and make it a pdf.

It sounds like

 a2ps 

followed by

 ps2pdf 

will do but I am not sure of the correct syntax. Thank you :).

I also tried:

 enscript -B --margins=10:10: -o outputfile.ps -f Courier@7.3/10 article.txt
$ ps2pdfwr outputfile.ps new.pdf
$ rm outputfile.ps 

and attached the output. [/CODE]

Thank you :).

Actually, I think your main problem is that the original file is UCS2-LE. And you may need plain ascii to use most tools, but you could convert to UTF-8 and then load and print to pdf using a browser (just an example). Shoot... you could actually do that using the UCS original file.

Anyway, to convert (for example) from UCS2-LE to UTF-8 you could do:

iconv -f UCS-2LE -t UTF-8 -o article-utf8.txt article.txt

Of course, you need iconv on your platform. But who knows, maybe the view and print from browser (e.g. Firefox) would work in your case?

Hope this gets you pointed in the right direction.

UCS2-LE is UTF-16. How did you see that - the sample was straight text?

1 Like

Actually, I just used the file command and saw it was UTF-16 Little-endian

1 Like

Thank you :).

An option in Linux is to load the txt file into LibreOffice Writer and export as pdf. I imagine you could do likewise with Windows Office too?