summaryrefslogtreecommitdiff
path: root/gs/lib/pdf_sec.ps
blob: 67ebbc1297c010aa41ccead5b43abc731697b7c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%    Copyright (C) 1996, 1997 Aladdin Enterprises.  All rights reserved.
% 
% This file is part of Aladdin Ghostscript.
% 
% Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
% or distributor accepts any responsibility for the consequences of using it,
% or for whether it serves any particular purpose or works at all, unless he
% or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
% License (the "License") for full details.
% 
% Every copy of Aladdin Ghostscript must include a copy of the License,
% normally in a plain ASCII text file named PUBLIC.  The License grants you
% the right to copy, modify and redistribute Aladdin Ghostscript, but only
% under certain conditions described in the License.  Among other things, the
% License requires that the copyright notice and this notice be preserved on
% all copies.

% pdf_sec.ps
% Security hooks for PDF reader.

% This file contains the procedures that have to take encryption into
% account when reading a PDF file.  There is no actual decryption code here,
% because U.S. export control laws might prohibit making this file available
% to anyone outside the U.S. if the code were included.  Instead, you can
% get the real version of this file from
%	http://www.ozemail.com.au/~geoffk/pdfencrypt/pdf_sec.ps
% or, if the ~ character upsets your software,
%	http://www.ozemail.com.au/%7Egeoffk/pdfencrypt/pdf_sec.ps
% NOTE: these URLs are referenced in the error message below.

/.setlanguagelevel where { pop 2 .setlanguagelevel } if
.currentglobal true .setglobal
/pdfdict where { pop } { /pdfdict 100 dict def } ifelse
pdfdict begin

% Process the encryption information in the Trailer.
/pdf_process_Encrypt
 { (\n\n) print
   (    **** The PDF input file uses encryption and cannot be processed.\n) print
   (    **** Please get and install the patch available from\n) print
   (    ****     http://www.ozemail.com.au/~geoffk/pdfencrypt/pdf_sec.ps\n) print
   (\n\n) print flush
   /pdfopen cvx /invalidfileaccess signalerror
 } bind def

% Run the code to resolve an object reference.
/pdf_run_resolve
 { PDFfile resolveopdict .pdfrun
 } bind def

% Prefix a decryption filter to a stream if needed.
% Stack: readdata? dict parms file/string filternames
/pdf_decrypt_stream
 {
 } bind def

end			% pdfdict
.setglobal