Skip to content
Advertisement

add a permitted path to ghostscipt running configuration

I use a program which create me postscript file before using ps2pdf to make it a readable pdf, i’ve made a program which add some string to overwrite the company new logo. (The first program can’t import image file itself).

I add the string before the before-last line of the file (” showpage”). While running my program to add the logo there is no error. With the option -dNOSAFER everything is fine, but by default it’s set to -dSAFER, and an invalidfileaccess error pop, the files are 6 jpg images alone in their directory.

I don’t want to make it run with the -dNOSAFER option on. As it will fully open the file system.

In the documentation I’ve seen that there is a “permitted path” setting, but i can’t find nowhere to set this up. Is it just a command line option to set in the command launching the program ? Or is there a config file for GhostScript / ps2pdf where i can put the path to this directory as permitted path.

in this documentation : http://www.ghostscript.com/doc/current/Use.htm

I only find

-dTTYPAUSE

Causes Ghostscript to read a character from /dev/tty, rather than standard input, at the end of each page. This may be useful if input is coming from a pipe. Note that -dTTYPAUSE overrides -dNOPAUSE. Also note that -dTTYPAUSE requires opening the terminal device directly, and may cause problems in combination with -dSAFER. Permission errors can be avoided by adding the device to the permitted reading list before invoking safer mode

gs -dTTYPAUSE -dDELAYSAFER -c '<< /PermitFileReading [ (/dev/tty)] >> setuserparams .locksafe' -dSAFER

The quote is just for the context but is this a way to put the permitted path ? As gs automatically launch with the full system as readOnly there will be no difference ? There is no other find result for PermitFile in this page.

Advertisement

Answer

Try adding the required path to the search path with -I (Include) See Use.htm, section 8 How Ghostscript finds files. This should only be a problem if you are using ‘run’ or similar to read files from another location.

The section on TTYPAUSE is not relevant.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement