Using Evince to open a DSC file generated by the pdf2dsc script is no longer possible

Updated

Introduction to the problem
In Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7 (prior to version 7.2), it was possible to convert a *.pdf (Portable Document Format) file into a *.dsc (Document Structure Convention) file with the pdf2dsc script, and open the converted *.dsc file with the Evince GNOME document viewer (Evince). The pdf2dsc script is one of the auxiliary Bash scripts distributed alongside Ghostscript.

With the update provided by This content is not included.RHSA-2017:0014, the described workflow no longer works. The -dSAFER option, which is enabled by default, has been fixed to work correctly in pdf2dsc and all other Ghostscript-related auxiliary scripts. The -dSAFER option forces Ghostscript to operate in sandbox mode. Operating in the sandbox environment helps mitigate potential damage to your system when you run a malicious file or script, but at the same time it can cause problems when trying to open a file on the file system outside the Ghostscript's sandbox, because Ghostscript does not allow access to any part of your system outside the sandbox.

Current status
The pdf2dsc script directs Ghostscript to read the original PDF file, which means that the DSC file generated by this script will not contain the original PDF1. Consequently, Evince or any other application relying on Ghostscript is no longer able to open the generated DSC file, located outside the Ghostscript's sandbox. If you try to open the generated DSC file from a file browser, it will be loading indefinitely. Opening the generated DSC file from a terminal will fail with the following error message:

invalidfileaccess -9

Workaround
To work around the problem, use one of the following ways of converting a PDF file into a true postscript (PS) file:

-Run the pdf2ps script 2 which is a part of the ghostscript package:

pdf2ps input.pdf [output.ps]

-Run the Ghostcript 3 conversion manually with this command:

gs -dSAFER -sDEVICE=ps2write -sOutputFile=output.ps input.pdf

Result
Both ways of converting will produce a true PS file which is portable and can be displayed with the Ghostcript reader or with any other postscript readers, such as Adobe Reader, xpost or emscript.

1

Note that the generated DSC file is not portable.
2: For more information about pdf2ps, see its manual page (man pdf2ps).
3: For more information about gs, see its manual page (man gs).

Article Type