When I try to open a PGP encrypted PDF file.pdf.gpg, then – after entering the PIN in my smartcard reader – a window pops up with an error message:

Error: /syntaxerror in (binary token, type=150)
Operand stack:
   -117240830   -2063108939
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fa
lse   1   %stopped_push   1967   1   3   %oparray_pop   1966   1   3   %oparray_
pop   1950   1   3   %oparray_pop   1836   1   3   %oparray_pop   --nostringval-
-   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringv
al--   2   %stopped_push
Dictionary stack:
   --dict:1200/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--
Current allocation mode is local
GPL Ghostscript 9.19: Unrecoverable error, exit code 1

Close this window with the close button on the title bar or the system menu.

I would expect the PDF to be shown in DocView mode.

About my system:

  • Windows 7 x64

  • GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570

  • Viewing PDFs in DocView mode works fine.

  • Viewing PGP encrypted text files with EasyPG Assistant (epa) works fine.


When you open a encrypted file, Emacs automatically replaces the contents of it's buffer with a decrypted version of it. Though doc-view, and for that matter pdf-view as well, does not care for the actual buffer content, but rather uses the buffer's file-name with various programs, in your case ghostscript, in order to produce images of the PDF pages. Since the actual file stays encrypted, these programs fail to do their job.

doc-view already handles files in archives and remote files, by copying them to a temporary file and using this file with said programs. It would be relatively easy to extend this behavior to encrypted files, but maybe this is considered a security risk. Or no one has thought of it yet.

  • Can support for decryption be added to doc-view simply by customizing options, or would the doc-view code need to be changed? If the temporary location where doc-view places a temporary file is on a RAM disk, then this should be safe. – feklee Aug 12 '16 at 12:32
  • You definitely would have to add some code somewhere. – politza Aug 12 '16 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.