That script is basically running these two commands for you:
Code:
Ted --setProperty usePostScriptFilters 1 --setProperty usePostScriptIndexedImages 1 --printToFile something.rtf temporaryfile.ps
gs -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="something.pdf" "temporaryfile.ps" -c quit
You can run the first command from xterm and see if you get the same error. If yes, then its something to do with Ted. If not, then it is happening with gs.
In either case, the error seems to be related to library Ted/gs depend upon. Did you install Ted using apt-get or built it manually or some other manner? Usually if you install the apps via repository (apt-get), then library dependencies are already sorted and such issues are minimum.