0
votes

I am trying to convert a PS file to PDF via Ghostscript (version 9.52). My problem is that the PS file has a reference to an external EPS file, this is a logo file which is normally in the printer memory. I have the source of this EPS file as well. When using the 'ps2pdf' script installed with Ghostscript I get an error on loading the EPS file. The code where the EPS gets loaded looks like this:

/showpage {} def
/setpagedevice  /pop load def
(logo.eps)          run
restore

When I run 'ps2pdf' the following error is shown:

Error: /invalidfileaccess in --run--
Operand stack:
   --nostringval--   (logo.eps)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   run   --nostringval--   2   %stopped_push   --nostringval--   run   run   false   1   %stopped_push   1990   1   3   %oparray_pop   1989   1   3   %oparray_pop   1977   1   3   %oparray_pop   1833   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   run   --nostringval--   2   %stopped_push   --nostringval--   1990   2   3   %oparray_pop   run
Dictionary stack:
   --dict:739/1123(ro)(G)--   --dict:0/20(G)--   --dict:82/200(L)--
Current allocation mode is local

Any suggestions on how to convert a PS file with EPS references to PDF?

1

1 Answers

2
votes

As noted in the recent release notes (and warned about for literally years) Ghostscript now ships with SAFER as the default.

When SAFER is actiuve the PostScript file operators are disabled, and will fail with an invalidfileaccess error. You need to either set -dNOSAFER (NOT recommended) or add the files you want to be able to access to the list of accessible files, reading and writing are treated separately).

This is all covered in the docuementation, you can find it online here (look for -dSAFER lower down the page from that link) or locally in ghostpdl/doc/Use.htm