2
votes

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?

2
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
yes, I used TAB for auto completionGergely
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
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
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

2 Answers

0
votes

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.

0
votes

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