Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run ps2pdf I get the following error messages:

norman@host:~$ ps2pdf test.pdf
While reading
ERROR: /syntaxerror in -file-
Operand stack:
   (   1   --nostringval--
Execution stack:
   %interp_exit   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:928/1123(G)--   --dict:0/20(G)--   --dict:74/200(L)--   --dict:928/1123(G)--   --dict:8/8(G)--   --dict:1/1(G)--
Current allocation mode is global
Current file position is 4623

I have tried re-installing gs and gs-esp without affect. Files, and all checked against a working system as being good. Regardless of what postscript file I try to convert, the "Current file position is 4623" remains exactly the same. The host is running Ubuntu 7.04.

Any suggestions as to what I should re-install will be much appreciated.

share|improve this question
Does ghostview and gs display the file correctly? – hlovdal Mar 20 '10 at 9:36
'ghostview' command not found. 'gs' gives the same error as ps2pdf. – simplr Mar 20 '10 at 12:56
I found that if I execute 'gs' without any parameters I still get the same error message. – simplr Mar 20 '10 at 13:07

Which version of Ghostscript do you use on your Ubuntu? You can check with the gs -v command. The latest released one is v8.71.

Your problem could come from 2 sources:

  1. Your file '' contains a bug (invalid PostScript code). Some PS bugs can be worked around by some viewers and PS processors, some not.
  2. Your version of Ghostscript contains a bug that is triggered by some procedure contained in your ''.

Without access to your '' file, there is no way for me to tell.

I'd recommend you try processing your '' with a newer version of Ghostscript. Don't use the ps2pdf utility. ps2pdf is just a small shell script that tries to simplify Ghostscript usage for PDF generation, but at the same time leaves a lot of Ghostscripts power behind.

Rather use gs directly. Like this:

gs \
  -sDEVICE=pdfwrite \
  -dBATCH \
  -dSAFER \
  -sCompatibilityLevel=1.4 \
  -dPDFSETTINGS=/prepress \
  -sOutputFile=/path/to/test.pdf \
  -c ".setpdfwrite" \
  -f /path/to/
share|improve this answer
Thank you for your reply, pipitas. The gs version is "ESP Ghostscript 8.15.4 (2007-03-14)". My file converts without error on other systems running the same version of gs. An fsck of the hard disk volume reported and repaired about 30 file allocation table errors. So no doubt something is corrupted. I re-installed gs and gs-esp. What other programs or libraries should I re-install? I did recommend to the user a complete update of the Linux, but they have not done so yet. – simplr Jun 26 '10 at 2:01
If not even a command gs -h works without spitting out an error, then surely your gs installation (or your harddisk) is corrupted somehow. – Kurt Pfeifle Aug 2 '10 at 16:48
To find out which are the dependent .so files, you can run the 'list dynamic dependencies' command: ldd $(which gs). This list will show you what libraris gs needs to run, and also where it found them (or not). With that list of files you can figure which other packages you may need to re-install. (Or run dpkg-query -s ghostscript | grep -i depends.) – Kurt Pfeifle Aug 2 '10 at 16:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.