2

Following

Converting correctly pdf to ps and vice-versa

I used the following command to convert a postscript file to pdf:

gs   -o output.pdf   -sDEVICE=pdfwrite   -dPDFSETTINGS=/prepress   -dHaveTrueTypes=true   -dEmbedAllFonts=true   -dSubsetFonts=false   -c ".setpdfwrite <</NeverEmbed [ ]>> setdistillerparams"   -f mu-calc.ps

but I got an error (I got the same error with ps2pdf):

GPL Ghostscript 9.06 (2012-08-08) Copyright (C) 2012 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Error: /undefinedfilename in (mu-calc.ps) Operand stack:

Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval-- --nostringval--
--nostringval-- false 1 %stopped_push Dictionary stack: --dict:1167/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)-- Current allocation mode is local Last OS error: Permission denied GPL Ghostscript 9.06: Unrecoverable error, exit code 1

I tried various other options at

Ghostscript: "Unrecoverable error: undefinedfilename in setpagedevice"

but I always got the same error.

How can I make it work?

Community
  • 1
  • 1
Gergely
  • 6,879
  • 6
  • 25
  • 35
  • 1
    That is, or appears to be, caused by the non-existence of the file you have specified 'mu-calc.ps'. Looks like the file isn't called that, or isn't present. Have you checked the file is present, called 'mu-calc.ps' and has the correct capitalisation ? – KenS Jul 05 '16 at 10:09
  • yes, I used TAB for auto completion – Gergely Jul 05 '16 at 10:46
  • Well then you are going to have to post the file somewhere where it can be examined. There's nothing more I can tell you from what you've posted. – KenS Jul 05 '16 at 10:55
  • Here it is: https://filebin.net/0nvsp0sj6yq2cdl2 Thanks for taking time. – Gergely Jul 05 '16 at 12:02
  • 2
    gs -sDEVICE=pdfwrite -sOutputFile=out.pdf mu-calc.ps works for me. Try a much simpler command line than the one you quoted, mine should be more than adequate. Failing that, try a more recent version of Ghostscript. I can't see any reason for the described error, except that the filename is incorrect or the file is missing. – KenS Jul 05 '16 at 12:15
  • The error might indicate that the `-dSAFER` option is interfering with file operators. Maybe try adding `-dNOSAFER` to the command. – luser droog Jul 05 '16 at 16:08
  • @KenS I have downloaded the latest 9.19 ghostscript to no avail – Gergely Jul 06 '16 at 07:39
  • @KenS sorry for taking your time, it turned out that scp copied the file onto the machine with 000 rights. There could be a better error message for this, though. – Gergely Jul 06 '16 at 07:44
  • 1
    Its a PostScript error message, we have to conform to the restrictions of the language. At first sight it would seem that invalidaccess would be preferable, but this is actually an error for trying to use the wrong kind of memory and would equally be confusing if used to refer to files. Remember, PostScript is an old language, and often ran on systems where there were no file permissions. – KenS Jul 06 '16 at 08:41

2 Answers2

0

It turned out that the file mu-calc.ps had no access rights on the Linux machine.

The error message

/undefinedfilename

was not precise, but this is because of the age of the postscript language, as the comment above explains. At that time, filesystems did not have file permissions.

Gergely
  • 6,879
  • 6
  • 25
  • 35
0

There is permission problem. Open the command prompt with administrator rights.

Khizer But
  • 11
  • 1