Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
90 views16 pages

The Pdfcrypt Package: Heiko Oberdiek 2016/05/16 v1.1

This document describes the pdfcrypt package, which allows setting pdf encryption options for VTEX and some older versions of pdfTEX. It provides instructions on package usage including setting owner/user passwords and permission options. The document also covers installation, alternatives to pdf encryption, and hints for using pdfcrypt with pdfTEX.

Uploaded by

Hossain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views16 pages

The Pdfcrypt Package: Heiko Oberdiek 2016/05/16 v1.1

This document describes the pdfcrypt package, which allows setting pdf encryption options for VTEX and some older versions of pdfTEX. It provides instructions on package usage including setting owner/user passwords and permission options. The document also covers installation, alternatives to pdf encryption, and hints for using pdfcrypt with pdfTEX.

Uploaded by

Hossain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

The pdfcrypt package

Heiko Oberdiek∗

2016/05/16 v1.1

Abstract
This package supports the setting of pdf encryption options for VTEX
and some older versions of pdfTEX.

Contents
1 Documentation 2
1.1 Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1 Special characters . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.2 \nopdfcrypt . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.3 Configuration file . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.4 Support for plain TEX . . . . . . . . . . . . . . . . . . . . . 3
1.3 Hints for pdfTEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Implementation 4
2.1 Help macros for plain TEX . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Package Identification and checks . . . . . . . . . . . . . . . . . . . 5
2.3 Driver detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Load package keyval . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 Define options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.6 support of configuration file . . . . . . . . . . . . . . . . . . . . . . 12
2.7 Package options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Installation 12
3.1 Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Bundle installation . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 Package installation . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4 Refresh file name databases . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Some details for the interested . . . . . . . . . . . . . . . . . . . . 13

4 History 14
[2001/04/02 v0.1] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
[2001/07/19 v0.2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
[2001/07/19 v0.3] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
[2001/07/19 v0.4] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
[2001/08/05 v0.5] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
[2001/08/09 v0.6] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
[2001/10/28 v0.7] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
[2006/02/20 v0.8] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
∗ Please report any issues at https://github.com/ho-tex/oberdiek/issues

1
[2007/04/11 v0.9] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
[2007/04/26 v1.0] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
[2016/05/16 v1.1] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5 Index 15

1 Documentation
This package allows the setting of pdf encryption options for
• VTEX, since version 7.35, http://www.micropress-inc.com/.
• pdfTEX, patched by Ricardo Sanchez Carmenes1 .
Some supported versions are:
pdfTEX-1.00a,
pdfTEX-0.14h-pdfcrypt-20010310,
pdfcrypt-20010331
Note: Since pdfTEX-1.10a (2003-01-16) encryption support was dropped! Thus
the package is now obsolete for recent pdfTEX versions.

1.1 Alternatives
There are free alternatives, programs that can be used for postprocessing the pdf
file:
• pdftk
http://www.accesspdf.com/pdftk/
• Multivalent
http://multivalent.sourceforge.net/
• PDFBox
http://www.pdfbox.org/
• PDFTrans
http://maddingue.free.fr/softwares/pdftrans.html
• ...

1.2 Usage
The options can be set as package options or with the command \pdfcryptsetup:
owner=⟨owner password ⟩
user=⟨user password ⟩
print, copy, edit, annotate=true, false
all, none
debug
The encryption is set at \begin{document} by default, but this can be forced for
an earlier time using the option set. Example:
\usepackage[owner=Donald,user=Knuth,print=false]{pdfcrypt}
...
\begin{document}
1 Ricardo Sanchez Carmenes’s email address: [email protected]

2
or

\usepackage{pdfcrypt}
\pdfcryptsetup{owner=Donald,user=Knut}
\pdfcryptsetup{print=false,set}
...
\begin{document}

1.2.1 Special characters


The characters ‘{’, ‘}’, and ‘\’ have to be escaped with ‘\’. Then the string should
not be specified as package option but with the macro \pdfcryptsetup, eg:
\pdfcryptsetup{user={\{\\Hello\}},print=false}
The password here is “{\Hello}”. Active characters can be used and are not
expanded. Macros except for \{, \}, and \\ should not be used and are not
expanded.

1.2.2 \nopdfcrypt
Often the whole process of pdf generation includes several TEX compilations and
perhaps other postprocessing steps. Therefore a feature would be useful to disable
the encryption stuff in order to speed up the first compilations. Therefore package
pdfcrypt will look for the macro \nopdfcrypt. If it has the meaning of the letter
‘Y’, the package will be disabled. Example:
pdflatex ’\let\nopdfcrypt=Y\input myfile’
thumbpdf myfile
pdfelatex myfile

1.2.3 Configuration file


If the file pdfcrypt.cfg exists it is loaded and can be used for common settings.

1.2.4 Support for plain TEX


The package can also be used with plain TEX. It defines the missing LATEX macros
and loads package keyval. The configuration file is not supported and automatically
loaded.

1.3 Hints for pdfTEX


This section is out of date, because the encryption support was removed from
pdfTEX. Therefore this hints are of historical interest only.

* There are packages such as thumbpdf that ship out


some stuff (\immediate\pdfobj{...}). In these cases
\pdfcrypt will be ignored without warning or error
message. Therefore the package pdfcrypt should be
loaded before and option "set" should be used in
order to force the call of \pdfcrypt, for example:
\usepackage{pdfcrypt}
\pdfcryptsetup{..., set}
...
\usepackage{thumbpdf}

3
* Compiling pdfTeX (eg. version 1.00a-pretest-20010804):
pdfTeX versions are available at
ftp://ftp.cstug.cz/pub/tex/local/cstug/thanh/pdftex/snapshots/
Unpack the latest .tgz file:
> tar xzf pdftex-20010804.tgz
Enable encryption support:
src> cd src/texk/web2c/pdftexdir
src/texk/web2c/pdftexdir> ln -fs pdfcrypt-full.c pdfcrypt.c
Compile:
src/texk/web2c/pdftexdir> cd ../../..
src> ./configure
src> cd texk/web2c
src/texk/web2c> make pdftexbin
At last install the binary and pool files.

2 Implementation
1 ⟨∗package⟩

2.1 Help macros for plain TEX


2 \expandafter\edef\csname pc@endinput\endcsname{%
3 \catcode‘\noexpand\@=\the\catcode‘\@\relax
4 \noexpand\endinput
5}
6 \catcode‘\@=11 %
7
8 \expandafter\ifx\csname @firstoftwo\endcsname\relax
9 \long\def\@firstoftwo#1#2{#1}%
10 \fi
11
12 \expandafter\ifx\csname @secondoftwo\endcsname\relax
13 \long\def\@secondoftwo#1#2{#2}%
14 \fi
15
16 \expandafter\ifx\csname @ifundefined\endcsname\relax
17 \def\@ifundefined#1{%
18 \expandafter\ifx\csname #1\endcsname\relax
19 \expandafter\@firstoftwo
20 \else
21 \expandafter\@secondoftwo
22 \fi
23 }%
24 \fi
25
26 \@ifundefined{@ifnextchar}{%
27 \long\def\@ifnextchar#1#2#3{%
28 \let\reserved@d=#1%
29 \def\reserved@a{#2}%
30 \def\reserved@b{#3}%
31 \futurelet\@let@token\@ifnch
32 }%
33 \def\@ifnch{%
34 \ifx\@let@token\@sptoken
35 \let\reserved@c\@xifnch
36 \else
37 \ifx\@let@token\reserved@d
38 \let\reserved@c\reserved@a

4
39 \else
40 \let\reserved@c\reserved@b
41 \fi
42 \fi
43 \reserved@c
44 }%
45 \begingroup
46 \def\:{\global\let\@sptoken= }%
47 \: %
48 \def\:{\@xifnch}%
49 \expandafter\gdef\: {\futurelet\@let@token\@ifnch}%
50 \endgroup
51 }{}
52
53 \@ifundefined{ProvidesPackage}{%
54 \def\ProvidesPackage#1{%
55 \@ifnextchar[{\pc@ProvidesPackage{#1}}%
56 {\pc@ProvidesPackage{#1}[]}%
57 }%
58 \def\pc@ProvidesPackage#1[#2]{%
59 \immediate\write-1{Package: #1 #2}%
60 }%
61 }{}
62
63 \begingroup\expandafter\expandafter\expandafter\endgroup
64 \expandafter\ifx\csname RequirePackage\endcsname\relax
65 \input infwarerr.sty\relax
66 \else
67 \RequirePackage{infwarerr}%
68 \fi
69
70 \@ifundefined{@gobble}{%
71 \long\def\@gobble#1{}%
72 }{}
73
74 \@ifundefined{@empty}{%
75 \def\@empty{}%
76 }{}

2.2 Package Identification and checks


77 \ProvidesPackage{pdfcrypt}%
78 [2016/05/16 v1.1 Allows the setting of PDF encryption (HO)]%
79 \@ifundefined{pdfcryptsetup}{%
80 \let\pdfcryptsetup\@gobble
81 }{%
82 \@PackageWarningNoLine{pdfcrypt}{Package pdfcrypt is already loaded}%
83 \pc@endinput
84 }

Support for \nopdfcrypt.


85 \newif\ifpc@nopdfcrypt
86 \ifx Y\nopdfcrypt
87 \@PackageWarningNoLine{pdfcrypt}{%
88 Encryption disabled by \string \nopdfcrypt\space request%
89 }%
90 \global\pc@nopdfcrypttrue
91 \fi

5
2.3 Driver detection
92 \let\pc@driver\@empty
93 \begingroup
94 % pdfTeX detection
95 \@ifundefined{pdfoutput}{%
96 }{%
97 \ifcase\pdfoutput
98 \else
99 \@ifundefined{pdfcrypt}{%
100 \@PackageError{pdfcrypt}{%
101 PDF encryption is not supported with this pdfTeX%
102 }{%
103 Encryption support was added in 0.14h (2001/03/10)\MessageBreak
104 and removed in 1.10a (2003/01/16).%
105 }%
106 \endgroup
107 \pc@endinput
108 }{%
109 \gdef\pc@driver{pdftex}%
110 }%
111 \fi
112 }%
113 % VTeX detection
114 \@ifundefined{OpMode}{%
115 }{%
116 \ifnum\OpMode=1 %
117 \ifnum\@ifundefined{VTeXversion}0\VTeXversion<735 %
118 \@PackageError{pdfcrypt}{%
119 PDF encryption is not supported with this VTeX%
120 }{%
121 You need VTeX 7.35 or higher.%
122 }%
123 \endgroup
124 \pc@endinput
125 \else
126 \gdef\pc@driver{vtex}%
127 \fi
128 \fi
129 }%
130 \endgroup

2.4 Load package keyval


131 \@ifundefined{@makeother}{%
132 \def\@makeother#1{\catcode‘#1=12\relax}%
133 }{}
134
135 \@ifundefined{g@addto@macro}{%
136 \long\def\g@addto@macro#1#2{%
137 \begingroup
138 \toks@\expandafter{#1#2}%
139 \xdef#1{\the\toks@}%
140 \endgroup
141 }%
142 }{}
143
144 \@ifundefined{@namedef}{%
145 \def\@namedef#1{\expandafter\def\csname#1\endcsname}%

6
146 }{}
147
148 \@ifundefined{@nameuse}{%
149 \def\@nameuse#1{\csname #1\endcsname}%
150 }{}
151
152 \def\pc@KeyvalRestore{%
153 \let\pc@KeyvalRestore\@undefined
154 }
155
156 \let\pcOrg@NeedsTeXFormat\NeedsTeXFormat
157 \@ifundefined{NeedsTeXFormat}{%
158 \def\NeedsTeXFormat#1{}%
159 \g@addto@macro\pc@KeyvalRestore{%
160 \let\NeedsTeXFormat\pcOrg@NeedsTeXFormat
161 }%
162 }{}
163
164 \let\pcOrg@DeclareOption\DeclareOption
165 \@ifundefined{DeclareOption}{%
166 \def\DeclareOption#1#2{#2}%
167 \g@addto@macro\pc@KeyvalRestore{%
168 \let\DeclareOption\pcOrg@DeclareOption
169 }%
170 }{}
171
172 \let\pcOrg@ExecuteOptions\ExecuteOptions
173 \@ifundefined{ExecuteOptions}{%
174 \def\ExecuteOptions#1{}%
175 \g@addto@macro\pc@KeyvalRestore{%
176 \let\ExecuteOptions\pcOrg@ExecuteOptions
177 }%
178 }{}
179
180 \let\pcOrg@ProcessOptions\ProcessOptions
181 \@ifundefined{ProcessOptions}{%
182 \def\ProcessOptions{}%
183 \g@addto@macro\pc@KeyvalRestore{%
184 \let\ProcessOptions\pcOrg@ProcessOptions
185 }%
186 }{}%
187
188 \begingroup\expandafter\expandafter\expandafter\endgroup
189 \expandafter\ifx\csname RequirePackage\endcsname\relax
190 \input keyval.sty\relax
191 \else
192 \RequirePackage{keyval}%
193 \fi
194 \pc@KeyvalRestore

2.5 Define options


195 \@ifundefined{@dblarg}{%
196 \long\def\@dblarg#1{\@ifnextchar[{#1}{\@xdblarg{#1}}}%
197 \long\def\@xdblarg#1#2{#1[{#2}]{#2}}%
198 }{}
199
200 \newif\ifpc@set
201 \newif\ifpc@print

7
202 \newif\ifpc@copy
203 \newif\ifpc@edit
204 \newif\ifpc@annotate
205 \newif\ifpc@debug
206 \let\pc@owner\@empty
207 \let\pc@user\@empty
208
209 % default: allow all
210 \pc@printtrue
211 \pc@copytrue
212 \pc@edittrue
213 \pc@annotatetrue
214
215 \edef\pc@temp{\catcode‘\noexpand\"=\the\catcode‘\"\relax}
216 \@makeother\"
217 \def\pc@set{%
218 \@PackageInfo{pdfcrypt}{%
219 \ifpc@debug
220 \ifx\pc@owner\@empty
221 No owner password%
222 \else
223 Owner password: ‘\pc@owner’%
224 \fi
225 \MessageBreak
226 \ifx\pc@user\@empty
227 No user password%
228 \else
229 User password: ‘\pc@user’%
230 \fi
231 \MessageBreak
232 Flags: %
233 \ifpc@print \else no\fi print, %
234 \ifpc@copy \else no\fi copy, %
235 \ifpc@edit \else no\fi edit, %
236 \ifpc@annotate\else no\fi annotate%
237 \MessageBreak
238 \fi
239 \ifpc@nopdfcrypt
240 Encryption is disabled by ‘\string\nopdfcrypt’%
241 \else
242 Encryption is set for ‘\pc@driver’%
243 \fi
244 }%
245 \ifpc@nopdfcrypt
246 \else
247 \@ifundefined{pc@set@\pc@driver}{%
248 \ifx\pc@driver\@empty
249 \@PackageError{pdfcrypt}{No driver for encryption %
250 support found}\@ehc
251 \else
252 \@PackageError{pdfcrypt}{Cannot set encryption for %
253 unknown driver ‘\pc@driver’}\@ehc
254 \fi
255 }{%
256 \@nameuse{pc@set@\pc@driver}%
257 }%
258 \fi
259 }

8
260 \def\pc@set@pdftex{%
261 \ifnum\pdftexversion<100 %
262 \pc@set@pdftexold
263 \else
264 \pc@set@pdftexnew
265 \fi
266 }
267 \def\pc@set@pdftexold{%
268 \pdfcrypt{%
269 owner "\pc@owner" %
270 user "\pc@user" %
271 \ifpc@print \else no\fi print %
272 \ifpc@copy \else no\fi copy %
273 \ifpc@edit \else no\fi edit %
274 \ifpc@annotate\else no\fi annotate%
275 }%
276 }
277 \def\pc@set@pdftexnew{%
278 \pdfcrypt
279 owner{\pc@owner}%
280 user{\pc@user}%
281 \ifpc@print \else no\fi print %
282 \ifpc@copy \else no\fi copy %
283 \ifpc@edit \else no\fi edit %
284 \ifpc@annotate\else no\fi annotate%
285 \relax
286 }
287 \def\pc@set@vtex{%
288 \immediate\special{!security %
289 O=\pc@MakeVTeXString\pc@owner,%
290 U=\pc@MakeVTeXString\pc@user,%
291 P\ifpc@print +\else -\fi,%
292 C\ifpc@copy +\else -\fi,%
293 M\ifpc@edit +\else -\fi,%
294 A\ifpc@annotate +\else -\fi
295 }%
296 }
297 \def\pc@MakeVTeXString#1{%
298 "\expandafter\pc@@MakeVTeXString#1"\@nil"%
299 }
300 \def\pc@@MakeVTeXString#1"#2\@nil{%
301 #1%
302 \ifx\\#2\\%
303 \else
304 ""%
305 \@ReturnAfterFi{%
306 \pc@@MakeVTeXString#2\@nil
307 }%
308 \fi
309 }
310 \long\def\@ReturnAfterFi#1\fi{\fi#1}
311 \pc@temp
312
313 \begingroup
314 \catcode‘\ =12 \gdef\pc@spaceother{ }\catcode‘\ =10\relax
315 \catcode‘\|=0 %
316 \catcode‘\\=12 %
317 |gdef|pc@DefString#1#2{%

9
318 |def#1{#2}%
319 |edef#1{|expandafter|strip@prefix|meaning#1}%
320 |edef#1{|expandafter|pc@SpaceToOther#1 |@nil}%
321 |edef#1{|expandafter|pc@EscapeRemove#1|@empty\|@empty|@nil}%
322 }%
323 |gdef|pc@EscapeRemove#1\#2#3|@nil{%
324 #1#2%
325 |ifx|\#3|\%%
326 |else
327 |@ReturnAfterFi{%
328 |pc@EscapeRemove#3|@nil
329 }%
330 |fi
331 }%
332 |endgroup
333 \def\pc@SpaceToOther#1 #2\@nil{%
334 #1%
335 \ifx\\#2\\%
336 \else
337 \pc@spaceother
338 \@ReturnAfterFi{%
339 \pc@SpaceToOther#2\@nil
340 }%
341 \fi
342 }
343
344 \def\pc@boolkey{\@dblarg\pc@@boolkey}
345 \def\pc@@boolkey[#1]#2#3{%
346 \lowercase{\def\pc@temp{#3}}%
347 \ifx\pc@temp\@empty
348 \let\pc@temp\pc@true
349 \fi
350 \ifx\pc@temp\pc@true
351 \else
352 \ifx\pc@temp\pc@false
353 \else
354 \let\pc@temp\relax
355 \fi
356 \fi
357 \ifx\pc@temp\relax
358 \@PackageWarning{pdfcrypt}{%
359 Unexpected value \string‘#3\string’ of %
360 option \string‘#2\string’\MessageBreak
361 instead of %
362 \string‘true\string’ or \string‘false\string’%
363 }%
364 \else
365 \csname pc@#2\pc@temp\endcsname
366 \fi
367 }
368 \def\pc@true{true}
369 \def\pc@false{false}
370
371 \define@key{pc}{set}[true]{%
372 \pc@boolkey{set}{#1}%
373 }
374 \define@key{pc}{pdftex}[]{%
375 \def\pc@driver{pdftex}%

10
376 }
377 \define@key{pc}{vtex}[]{%
378 \def\pc@driver{vtex}%
379 }
380 \define@key{pc}{print}[true]{%
381 \pc@boolkey{print}{#1}%
382 }
383 \define@key{pc}{copy}[true]{%
384 \pc@boolkey{copy}{#1}%
385 }
386 \define@key{pc}{edit}[true]{%
387 \pc@boolkey{edit}{#1}%
388 }
389 \define@key{pc}{annotate}[true]{%
390 \pc@boolkey{annotate}{#1}%
391 }
392 \define@key{pc}{all}[]{%
393 \pc@boolkey{print}{true}%
394 \pc@boolkey{copy}{true}%
395 \pc@boolkey{edit}{true}%
396 \pc@boolkey{annotate}{true}%
397 }
398 \define@key{pc}{none}[]{%
399 \pc@boolkey{print}{false}%
400 \pc@boolkey{copy}{false}%
401 \pc@boolkey{edit}{false}%
402 \pc@boolkey{annotate}{false}%
403 }
404
405 \define@key{pc}{owner}{%
406 \pc@DefString\pc@owner{#1}%
407 }
408 \define@key{pc}{user}{%
409 \pc@DefString\pc@user{#1}%
410 }
411 \define@key{pc}{debug}[true]{%
412 \pc@boolkey{debug}{#1}%
413 }
414
415 \def\pdfcryptsetup#1{%
416 \setkeys{pc}{#1}%
417 \ifpc@set
418 \pc@set
419 \global\let\pc@set\relax
420 \gdef\pdfcryptsetup##1{%
421 \@PackageWarning{pdfcrypt}{%
422 Encryption options are already set\MessageBreak
423 new values are ignored%
424 }%
425 }%
426 \fi
427 }
428 \begingroup\expandafter\expandafter\expandafter\endgroup
429 \expandafter\ifx\csname @onlypreamble\endcsname\relax
430 \else
431 \@onlypreamble\pdfcryptsetup
432 \fi

11
2.6 support of configuration file
433 \begingroup\expandafter\expandafter\expandafter\endgroup
434 \expandafter\ifx\csname InputIfFileExists\endcsname\relax
435 \@PackageInfo{pdfcrypt}{%
436 Configuration file pdfcrypt.cfg not supported.%
437 }%
438 \else
439 \let\pc@ExecuteOptions\ExecuteOptions
440 \InputIfFileExists{pdfcrypt.cfg}{}{}%
441 \let\ExecuteOptions\pc@ExecuteOptions
442 \fi

2.7 Package options


Plain format does not know package options.
443 \begingroup\expandafter\expandafter\expandafter\endgroup
444 \expandafter\ifx\csname @classoptionslist\endcsname\relax
445 \expandafter\pc@endinput
446 \fi

Process global and local options.


447 \def\pc@ProcessOptionsWithKV{%
448 \let\pc@temp\@empty
449 \@for\CurrentOption:=\@classoptionslist\do{%
450 \@ifundefined{KV@pc@\CurrentOption}{}{%
451 \edef\pc@temp{\pc@temp,\CurrentOption,}%
452 \@expandtwoargs\@removeelement\CurrentOption
453 \@unusedoptionlist\@unusedoptionlist
454 }%
455 }%
456 \edef\pc@temp{%
457 \noexpand\pdfcryptsetup{%
458 \pc@temp\@ptionlist{\@currname.\@currext}%
459 }%
460 }%
461 \pc@temp
462 }
463 \pc@ProcessOptionsWithKV
464 \AtEndOfPackage{\let\@unprocessedoptions\relax}
465 \AtBeginDocument{\pc@set}
466
467 \pc@endinput
468 ⟨/package⟩

3 Installation
3.1 Download
Package. This package is available on CTAN2 :
CTAN:macros/latex/contrib/oberdiek/pdfcrypt.dtx The source file.

CTAN:macros/latex/contrib/oberdiek/pdfcrypt.pdf Documentation.
2 CTAN:pkg/pdfcrypt

12
Bundle. All the packages of the bundle ‘oberdiek’ are also available in a TDS
compliant ZIP archive. There the packages are already unpacked and the docu-
mentation files are generated. The files and directories obey the TDS standard.
CTAN:install/macros/latex/contrib/oberdiek.tds.zip
TDS refers to the standard “A Directory Structure for TEX Files” (CTAN:pkg/
tds). Directories with texmf in their name are usually organized this way.

3.2 Bundle installation


Unpacking. Unpack the oberdiek.tds.zip in the TDS tree (also known as
texmf tree) of your choice. Example (linux):

unzip oberdiek.tds.zip -d ~/texmf

3.3 Package installation


Unpacking. The .dtx file is a self-extracting docstrip archive. The files are
extracted by running the .dtx through plain TEX:
tex pdfcrypt.dtx

TDS. Now the different files must be moved into the different directories in your
installation TDS tree (also known as texmf tree):
pdfcrypt.sty → tex/generic/oberdiek/pdfcrypt.sty
pdfcrypt.pdf → doc/latex/oberdiek/pdfcrypt.pdf
pdfcrypt.dtx → source/latex/oberdiek/pdfcrypt.dtx
If you have a docstrip.cfg that configures and enables docstrip’s TDS installing
feature, then some files can already be in the right place, see the documentation
of docstrip.

3.4 Refresh file name databases


If your TEX distribution (TEX Live, MiKTEX, . . . ) relies on file name databases,
you must refresh these. For example, TEX Live users run texhash or mktexlsr.

3.5 Some details for the interested


Unpacking with LATEX. The .dtx chooses its action depending on the format:
plain TEX: Run docstrip and extract the files.
LATEX: Generate the documentation.
If you insist on using LATEX for docstrip (really, docstrip does not need LATEX),
then inform the autodetect routine about your intention:
latex \let\install=y\input{pdfcrypt.dtx}
Do not forget to quote the argument according to the demands of your shell.

13
Generating the documentation. You can use both the .dtx or the .drv to
generate the documentation. The process can be configured by the configuration
file ltxdoc.cfg. For instance, put this line into this file, if you want to have A4
as paper format:
\PassOptionsToClass{a4paper}{article}

An example follows how to generate the documentation with pdfLATEX:


pdflatex pdfcrypt.dtx
makeindex -s gind.ist pdfcrypt.idx
pdflatex pdfcrypt.dtx
makeindex -s gind.ist pdfcrypt.idx
pdflatex pdfcrypt.dtx

4 History
[2001/04/02 v0.1]
• First public version, published in the pdftex mailing list for testing with
pdfcrypt-20010331

[2001/07/19 v0.2]
• Default: all allowed.
• Support for VTEX added.

[2001/07/19 v0.3]
• Bug fix: VTEX letter for edit is M (modify).

[2001/07/19 v0.4]
• Bug fix: \VTeXversion is correct after regenerating the format file.

[2001/08/05 v0.5]
• Syntax change in pdfTEX 1.00a.

[2001/08/09 v0.6]
• Support of special characters:
input: \{, \}, \\ for {, }, \
output: " in VTEX

• Option debug added.

[2001/10/28 v0.7]
• Plain compatibility.
• \nopdfcrypt added.
• Typos corrected.

14
[2006/02/20 v0.8]
• Obsolete remarks for pdfTEX.
• DTX framework.
• LPPL 1.3

[2007/04/11 v0.9]
• Line ends sanitized.

[2007/04/26 v1.0]
• Use of package infwarerr.

[2016/05/16 v1.1]
• Documentation updates.

5 Index
Numbers written in italic refer to the page where the corresponding entry is de-
scribed; numbers underlined refer to the code line of the definition; plain numbers
refer to the code lines where the entry is used.

Symbols \@nameuse . . . . . . . . . . . . . . . 149, 256


\" . . . . . . . . . . . . . . . . . . . . . 215, 216 \@nil . . . . . . . . 298, 300, 306, 333, 339
\# . . . . . . . . . . . . . . . . . . . . . 323, 325 \@onlypreamble . . . . . . . . . . . . . . . 431
\% . . . . . . . . . . . . . . . . . . . . . . . . . 325 \@ptionlist . . . . . . . . . . . . . . . . . . 458
\: . . . . . . . . . . . . . . . . . 46, 47, 48, 49 \@removeelement . . . . . . . . . . . . . . 452
\@ . . . . . . . . . . . . . . . . . . . . . . . . 3, 6 \@secondoftwo . . . . . . . . . . . . . . 13, 21
\@PackageError . . . . 100, 118, 249, 252 \@sptoken . . . . . . . . . . . . . . . . . 34, 46
\@PackageInfo . . . . . . . . . . . . 218, 435 \@undefined . . . . . . . . . . . . . . . . . . 153
\@PackageWarning . . . . . . . . . 358, 421 \@unprocessedoptions . . . . . . . . . . 464
\@PackageWarningNoLine . . . . . . 82, 87 \@unusedoptionlist . . . . . . . . . . . . 453
\@ReturnAfterFi . . . . . . 305, 310, 338 \@xdblarg . . . . . . . . . . . . . . . 196, 197
\@classoptionslist . . . . . . . . . . . . 449 \@xifnch . . . . . . . . . . . . . . . . . . 35, 48
\@currext . . . . . . . . . . . . . . . . . . . 458 \\ . . . . . . . . . . . . . . . . . 302, 316, 335
\@currname . . . . . . . . . . . . . . . . . . 458 \| . . . . . . . . . . . . . . . . . . . . . 315, 321
\@dblarg . . . . . . . . . . . . . . . . 196, 344
\@ehc . . . . . . . . . . . . . . . . . . . 250, 253
\@empty . . . . . . . . . . . . . . . . . . 75, \␣ . . . . . . . . . . . . . . . . . . . . . . . . . 314
92, 206, 207, 220, 226, 248, 347, 448
A
\@expandtwoargs . . . . . . . . . . . . . . 452
\AtBeginDocument . . . . . . . . . . . . . 465
\@firstoftwo . . . . . . . . . . . . . . . . 9, 19
\AtEndOfPackage . . . . . . . . . . . . . . 464
\@for . . . . . . . . . . . . . . . . . . . . . . . 449
\@gobble . . . . . . . . . . . . . . . . . . 71, 80 C
\@ifnch . . . . . . . . . . . . . . . . 31, 33, 49 \catcode . . 3, 6, 132, 215, 314, 315, 316
\@ifnextchar . . . . . . . . . . . 27, 55, 196 \csname . . . . . . . . . 2, 8, 12, 16, 18,
\@ifundefined . . . . . . . . . . . . . . . . 64, 145, 149, 189, 365, 429, 434, 444
. . . . 17, 26, 53, 70, 74, 79, 95, \CurrentOption . . . . 449, 450, 451, 452
99, 114, 117, 131, 135, 144, 148,
157, 165, 173, 181, 195, 247, 450 D
\@let@token . . . . . . . . . . 31, 34, 37, 49 \DeclareOption . . . . . . . 164, 166, 168
\@makeother . . . . . . . . . . . . . . 132, 216 \define@key 371, 374, 377, 380, 383,
\@namedef . . . . . . . . . . . . . . . . . . . 145 386, 389, 392, 398, 405, 408, 411

15
\do . . . . . . . . . . . . . . . . . . . . . . . . 449 \pc@edittrue . . . . . . . . . . . . . . . . . 212
\pc@endinput . . . 83, 107, 124, 445, 467
E \pc@ExecuteOptions . . . . . . . . 439, 441
\endcsname . . . . . . 2, 8, 12, 16, 18, \pc@false . . . . . . . . . . . . . . . 352, 369
64, 145, 149, 189, 365, 429, 434, 444 \pc@KeyvalRestore . . . . . . . . . . . .
\endinput . . . . . . . . . . . . . . . . . . . . 4 . 152, 153, 159, 167, 175, 183, 194
\ExecuteOptions 172, 174, 176, 439, 441 \pc@MakeVTeXString . . . . 289, 290, 297
\pc@nopdfcrypttrue . . . . . . . . . . . . 90
F \pc@owner . . . . . . . . . . . . . . . . . . .
\futurelet . . . . . . . . . . . . . . . . 31, 49 . 206, 220, 223, 269, 279, 289, 406
\pc@printtrue . . . . . . . . . . . . . . . . 210
G \pc@ProcessOptionsWithKV . . . 447, 463
\g@addto@macro 136, 159, 167, 175, 183
\pc@ProvidesPackage . . . . . . 55, 56, 58
\gdef . . . . . . . . . 49, 109, 126, 314, 420
\pc@set . . . . . . . . . . 217, 418, 419, 465
\pc@set@pdftex . . . . . . . . . . . . . . . 260
I
\pc@set@pdftexnew . . . . . . . . 264, 277
\ifcase . . . . . . . . . . . . . . . . . . . . . 97
\pc@set@pdftexold . . . . . . . . 262, 267
\ifnum . . . . . . . . . . . . . . 116, 117, 261
\pc@set@vtex . . . . . . . . . . . . . . . . . 287
\ifpc@annotate 204, 236, 274, 284, 294
\pc@spaceother . . . . . . . . . . . 314, 337
\ifpc@copy . . . 202, 234, 272, 282, 292
\pc@SpaceToOther . . . . . . . . . 333, 339
\ifpc@debug . . . . . . . . . . . . . . 205, 219
\pc@temp . . . . . . . . . . . . . 215, 311,
\ifpc@edit . . . 203, 235, 273, 283, 293
346, 347, 348, 350, 352, 354,
\ifpc@nopdfcrypt . . . . . . 85, 239, 245
357, 365, 448, 451, 456, 458, 461
\ifpc@print . . . 201, 233, 271, 281, 291
\ifpc@set . . . . . . . . . . . . . . . 200, 417 \pc@true . . . . . . . . . . . . 348, 350, 368
\ifx . . . . . . 8, 12, 16, 18, 34, 37, 64, \pc@user 207, 226, 229, 270, 280, 290, 409
86, 189, 220, 226, 248, 302, 335, \pcOrg@DeclareOption . . . . . . 164, 168
347, 350, 352, 357, 429, 434, 444 \pcOrg@ExecuteOptions . . . . . 172, 176
\immediate . . . . . . . . . . . . . . . 59, 288 \pcOrg@NeedsTeXFormat . . . . . 156, 160
\input . . . . . . . . . . . . . . . . . . . 65, 190 \pcOrg@ProcessOptions . . . . . 180, 184
\InputIfFileExists . . . . . . . . . . . . 440 \pdfcrypt . . . . . . . . . . . . . . . 268, 278
\pdfcryptsetup . 80, 415, 420, 431, 457
L \pdfoutput . . . . . . . . . . . . . . . . . . 97
\lowercase . . . . . . . . . . . . . . . . . . 346 \pdftexversion . . . . . . . . . . . . . . . 261
\ProcessOptions . . . . . . 180, 182, 184
M \ProvidesPackage . . . . . . . . . . . 54, 77
\MessageBreak . . . . . . . . . . . . . . . .
. . . . . 103, 225, 231, 237, 360, 422 R
\RequirePackage . .. . . . . . . . . 67, 192
N \reserved@a . . . . . .. . . . . . . . . . 29, 38
\NeedsTeXFormat . . . . . . 156, 158, 160 \reserved@b . . . . . .. . . . . . . . . . 30, 40
\newif . 85, 200, 201, 202, 203, 204, 205 \reserved@c . . . . . .. . . . 35, 38, 40, 43
\nopdfcrypt . . . . . . . . . . . . 86, 88, 240 \reserved@d . . . . . .. . . . . . . . . . 28, 37

O S
\OpMode . . . . . . . . . . . . . . . . . . . . . 116 \setkeys . . . . . . . . . . . . . . . . . . . . 416
\space . . . . . . . . . . . . . . . . . . . . . . 88
P \special . . . . . . . . . . . . . . . . . . . . 288
\pc@@boolkey . . . . . . . . . . . . . 344, 345
\pc@@MakeVTeXString . . . 298, 300, 306 T
\pc@annotatetrue . . . . . . . . . . . . . 213 \the . . . . . . . . . . . . . . . . . . 3, 139, 215
\pc@boolkey . . . . . . . . . . . 344, 372, \toks@ . . . . . . . . . . . . . . . . . . 138, 139
381, 384, 387, 390, 393, 394,
395, 396, 399, 400, 401, 402, 412 V
\pc@copytrue . . . . . . . . . . . . . . . . . 211 \VTeXversion . . . . . . . . . . . . . . . . . 117
\pc@DefString . . . . . . . . . . . . 406, 409
\pc@driver . . . . . . . . 92, 109, 126, W
242, 247, 248, 253, 256, 375, 378 \write . . . . . . . . . . . . . . . . . . . . . . 59

16

You might also like