Bug 691125

Summary: Ghostscript won't render encrypted files
Product: Ghostscript Reporter: Jose Carlos Santos <jcsantos>
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: RESOLVED WORKSFORME    
Severity: major    
Priority: P4    
Version: 8.71   
Hardware: PC   
OS: Windows XP   
Customer: Word Size: ---
Attachments: h.pdf

Description Jose Carlos Santos 2010-02-19 15:16:00 UTC
Ghostscript seems unable to read password protected PDF files. When I try I get
this message:

GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
   **** This file requires a password for access.
   **** The file was produced by:
   **** >>>> ¢äG>&#9577;þÓ&#9787;õ/"q´WwCðq´Ôm <<<<
Error: /invalidfileaccess in pdf_process_Encrypt
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fa
lse   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_
pop   1861   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostri
ngval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:1155/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75
/200(L)--   --dict:108/127(ro)(G)--   --dict:288/300(ro)(G)--   --dict:18/25(L)-
-
Current allocation mode is local
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
Comment 1 Jose Carlos Santos 2010-02-19 15:18:02 UTC
Created attachment 5972 [details]
h.pdf

The attached file is protected by the password "a". I can open it with Adobe
Reader or with SumatraPDF, but not with Ghostscript.
Comment 2 Hin-Tak Leung 2010-02-19 15:35:18 UTC
See bundled documentation (doc/Use.htm), the correct usage is:
gs -sPDFPassword=a h.pdf

The error message states the problem correctly, and the option is documented;
acrobat reader shows a popup box asking for the password. gs's typical
non-interactive usage never create pop-up's, so gs is working as intended.

If the reporter feels the documentation is inadequate and/or the error message
can be more informative, feel free to open another bug against documentation or
the error message.