7

I have problem converting a file to PDF. I create the file with

echo ęąśćżńł > text

and convert:

enscript -O text -o - | ps2pdf - out.pdf

However, out.pdf has an encoding problem:

screenshot of corrupted pdf file

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Miko
  • 71
  • 2

2 Answers2

6

enscript just does not support Unicode. You need to use a different tool such as paps to convert text to PostScript. With --header option an output .pdf is similar to one produced with enscript:

$ paps text --header | ps2pdf - outheader.pdf
Arkadiusz Drabczyk
  • 25,049
  • 5
  • 53
  • 68
4

I have had a better experience with the u2ps program written by Alex Suykov which produces much smaller PDF files using system Unicode fonts. This program is not in Ubuntu or Fedora; you have to compile it yourself. The usage is the same:

$ u2ps text.txt | ps2pdf - text.pdf

(Compared to u2ps, paps output is huge).

Maxim
  • 280
  • 2
  • 5