Debian Codegraph @

texmf-dist/source/latex/oberdiek/pdfcrypt.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: pdfcrypt.dtx
4 % Version: 2016/05/16 v1.1
5 % Info: Allows the setting of PDF encryption
6 %
7 % Copyright (C)
8 % 2001, 2006, 2007 Heiko Oberdiek
9 % 2016-2019 Oberdiek Package Support Group
10 % https://github.com/ho-tex/oberdiek/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/oberdiek/issues
27 %
28 % The Base Interpreter refers to any `TeX-Format',
29 % because some files are installed in TDS:tex/generic//.
30 %
31 % This work consists of the main source file pdfcrypt.dtx
32 % and the derived files
33 % pdfcrypt.sty, pdfcrypt.pdf, pdfcrypt.ins, pdfcrypt.drv.
34 %
35 % Distribution:
36 % CTAN:macros/latex/contrib/oberdiek/pdfcrypt.dtx
37 % CTAN:macros/latex/contrib/oberdiek/pdfcrypt.pdf
38 %
39 % Unpacking:
40 % (a) If pdfcrypt.ins is present:
41 % tex pdfcrypt.ins
42 % (b) Without pdfcrypt.ins:
43 % tex pdfcrypt.dtx
44 % (c) If you insist on using LaTeX
45 % latex \let\install=y\input{pdfcrypt.dtx}
46 % (quote the arguments according to the demands of your shell)
47 %
48 % Documentation:
49 % (a) If pdfcrypt.drv is present:
50 % latex pdfcrypt.drv
51 % (b) Without pdfcrypt.drv:
52 % latex pdfcrypt.dtx; ...
53 % The class ltxdoc loads the configuration file ltxdoc.cfg
54 % if available. Here you can specify further options, e.g.
55 % use A4 as paper format:
56 % \PassOptionsToClass{a4paper}{article}
57 %
58 % Program calls to get the documentation (example):
59 % pdflatex pdfcrypt.dtx
60 % makeindex -s gind.ist pdfcrypt.idx
61 % pdflatex pdfcrypt.dtx
62 % makeindex -s gind.ist pdfcrypt.idx
63 % pdflatex pdfcrypt.dtx
64 %
65 % Installation:
66 % TDS:tex/generic/oberdiek/pdfcrypt.sty
67 % TDS:doc/latex/oberdiek/pdfcrypt.pdf
68 % TDS:source/latex/oberdiek/pdfcrypt.dtx
69 %
70 %<*ignore>
71 \begingroup
72 \catcode123=1 %
73 \catcode125=2 %
74 \def\x{LaTeX2e}%
75 \expandafter\endgroup
76 \ifcase 0\ifx\install y1\fi\expandafter
77 \ifx\csname processbatchFile\endcsname\relax\else1\fi
78 \ifx\fmtname\x\else 1\fi\relax
79 \else\csname fi\endcsname
80 %</ignore>
81 %<*install>
82 \input docstrip.tex
83 \Msg{************************************************************************}
84 \Msg{* Installation}
85 \Msg{* Package: pdfcrypt 2016/05/16 v1.1 Allows the setting of PDF encryption (HO)}
86 \Msg{************************************************************************}
87
88 \keepsilent
89 \askforoverwritefalse
90
91 \let\MetaPrefix\relax
92 \preamble
93
94 This is a generated file.
95
96 Project: pdfcrypt
97 Version: 2016/05/16 v1.1
98
99 Copyright (C)
100 2001, 2006, 2007 Heiko Oberdiek
101 2016-2019 Oberdiek Package Support Group
102
103 This work may be distributed and/or modified under the
104 conditions of the LaTeX Project Public License, either
105 version 1.3c of this license or (at your option) any later
106 version. This version of this license is in
107 https://www.latex-project.org/lppl/lppl-1-3c.txt
108 and the latest version of this license is in
109 https://www.latex-project.org/lppl.txt
110 and version 1.3 or later is part of all distributions of
111 LaTeX version 2005/12/01 or later.
112
113 This work has the LPPL maintenance status "maintained".
114
115 The Current Maintainers of this work are
116 Heiko Oberdiek and the Oberdiek Package Support Group
117 https://github.com/ho-tex/oberdiek/issues
118
119
120 The Base Interpreter refers to any `TeX-Format',
121 because some files are installed in TDS:tex/generic//.
122
123 This work consists of the main source file pdfcrypt.dtx
124 and the derived files
125 pdfcrypt.sty, pdfcrypt.pdf, pdfcrypt.ins, pdfcrypt.drv.
126
127 \endpreamble
128 \let\MetaPrefix\DoubleperCent
129
130 \generate{%
131 \file{pdfcrypt.ins}{\from{pdfcrypt.dtx}{install}}%
132 \file{pdfcrypt.drv}{\from{pdfcrypt.dtx}{driver}}%
133 \usedir{tex/generic/oberdiek}%
134 \file{pdfcrypt.sty}{\from{pdfcrypt.dtx}{package}}%
135 }
136
137 \catcode32=13\relax% active space
138 \let =\space%
139 \Msg{************************************************************************}
140 \Msg{*}
141 \Msg{* To finish the installation you have to move the following}
142 \Msg{* file into a directory searched by TeX:}
143 \Msg{*}
144 \Msg{* pdfcrypt.sty}
145 \Msg{*}
146 \Msg{* To produce the documentation run the file `pdfcrypt.drv'}
147 \Msg{* through LaTeX.}
148 \Msg{*}
149 \Msg{* Happy TeXing!}
150 \Msg{*}
151 \Msg{************************************************************************}
152
153 \endbatchfile
154 %</install>
155 %<*ignore>
156 \fi
157 %</ignore>
158 %<*driver>
159 \NeedsTeXFormat{LaTeX2e}
160 \ProvidesFile{pdfcrypt.drv}%
161 [2016/05/16 v1.1 Allows the setting of PDF encryption (HO)]%
162 \documentclass{ltxdoc}
163 \usepackage{holtxdoc}[2011/11/22]
164 \begin{document}
165 \DocInput{pdfcrypt.dtx}%
166 \end{document}
167 %</driver>
168 % \fi
169 %
170 %
171 %
172 % \GetFileInfo{pdfcrypt.drv}
173 %
174 % \title{The \xpackage{pdfcrypt} package}
175 % \date{2016/05/16 v1.1}
176 % \author{Heiko Oberdiek\thanks
177 % {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}}
178 %
179 % \maketitle
180 %
181 % \begin{abstract}
182 % This package supports the setting of pdf encryption options
183 % for \VTeX\ and some older versions of \pdfTeX.
184 % \end{abstract}
185 %
186 % \tableofcontents
187 %
188 % \section{Documentation}
189 %
190 % This package allows the setting of pdf encryption
191 % options for
192 % \begin{itemize}
193 % \item
194 % \VTeX, since version 7.35, \url{http://www.micropress-inc.com/}.
195 % \item
196 % \pdfTeX, patched by
197 % \NameEmail{Ricardo Sanchez Carmenes}{[email protected]}.\\
198 % Some supported versions are:
199 % \begin{quote}
200 % \pdfTeX-1.00a,\\
201 % \pdfTeX-0.14h-pdfcrypt-20010310,\\
202 % pdfcrypt-20010331
203 % \end{quote}
204 % \end{itemize}
205 %
206 % \noindent
207 % \textcolor{red}{Note:} Since \pdfTeX-1.10a (2003-01-16) encryption
208 % support was dropped! Thus the package is now obsolete for recent
209 % \pdfTeX\ versions.
210 %
211 % \subsection{Alternatives}
212 %
213 % There are free alternatives, programs that can
214 % be used for postprocessing the pdf file:
215 % \begin{itemize}
216 % \item \textsf{pdftk}\\
217 % \url{http://www.accesspdf.com/pdftk/}
218 % \item \textsf{Multivalent}\\
219 % \url{http://multivalent.sourceforge.net/}
220 % \item \textsf{PDFBox}\\
221 % \url{http://www.pdfbox.org/}
222 % \item \textsf{PDFTrans}\\
223 % \url{http://maddingue.free.fr/softwares/pdftrans.html}
224 % \item \dots
225 % \end{itemize}
226 %
227 % \subsection{Usage}
228 %
229 % The options can be set as package options or
230 % with the command \cs{pdfcryptsetup}:
231 % \begin{quote}
232 % |owner=|\meta{owner password}\\
233 % |user=|\meta{user password}\\
234 % |print|, |copy|, |edit|, |annotate=true|, |false|\\
235 % |all|, |none|\\
236 % |debug|
237 % \end{quote}
238 % The encryption is set at |\begin{document}| by default,
239 % but this can be forced for an earlier time
240 % using the option |set|.
241 % Example:
242 % \begin{quote}
243 % |\usepackage[owner=Donald,user=Knuth,print=false]{pdfcrypt}|\\
244 % \dots\\
245 % |\begin{document}|
246 % \end{quote}
247 % or
248 % \begin{quote}
249 % |\usepackage{pdfcrypt}|\\
250 % |\pdfcryptsetup{owner=Donald,user=Knut}|\\
251 % |\pdfcryptsetup{print=false,set}|\\
252 % \dots\\
253 % |\begin{document}|
254 % \end{quote}
255 %
256 % \subsubsection{Special characters}
257 %
258 % The characters `|{|', `|}|', and `|\|' have to be
259 % escaped with `|\|'. Then the string should not
260 % be specified as package option but with
261 % the macro \cs{pdfcryptsetup}, eg:
262 % \begin{quote}
263 % |\pdfcryptsetup{user={\{\\Hello\}},print=false}|
264 % \end{quote}
265 % The password here is ``|{\Hello}|''.
266 % Active characters can be used and are not expanded.
267 % Macros except for |\{|, |\}|, and |\\| should not be used
268 % and are not expanded.
269 %
270 % \subsubsection{\cs{nopdfcrypt}}
271 %
272 % Often the whole process of pdf generation includes
273 % several \TeX\ compilations and perhaps other
274 % postprocessing steps. Therefore a feature would
275 % be useful to disable the encryption stuff in order
276 % to speed up the first compilations.
277 % Therefore package \xpackage{pdfcrypt} will look for
278 % the macro \cs{nopdfcrypt}. If it has the meaning of the
279 % letter `|Y|', the package will be disabled.
280 % Example:
281 % \begin{quote}
282 % |pdflatex '\let\nopdfcrypt=Y\input myfile'|\\
283 % |thumbpdf myfile|\\
284 % |pdfelatex myfile|
285 % \end{quote}
286 %
287 % \subsubsection{Configuration file}
288 %
289 % If the file \xfile{pdfcrypt.cfg} exists it is loaded
290 % and can be used for common settings.
291 %
292 % \subsubsection{Support for \plainTeX}
293 %
294 % The package can also be used with \plainTeX. It defines the
295 % missing \LaTeX\ macros and loads package \xpackage{keyval}.
296 % The configuration file is not supported and automatically
297 % loaded.
298 %
299 % \subsection{Hints for \pdfTeX}
300 %
301 % This section is out of date, because the encryption support
302 % was removed from \pdfTeX. Therefore this hints are of
303 % historical interest only.
304 %
305 %\begin{verbatim}
306 %* There are packages such as thumbpdf that ship out
307 % some stuff (\immediate\pdfobj{...}). In these cases
308 % \pdfcrypt will be ignored without warning or error
309 % message. Therefore the package pdfcrypt should be
310 % loaded before and option "set" should be used in
311 % order to force the call of \pdfcrypt, for example:
312 % \usepackage{pdfcrypt}
313 % \pdfcryptsetup{..., set}
314 % ...
315 % \usepackage{thumbpdf}
316 %
317 %* Compiling pdfTeX (eg. version 1.00a-pretest-20010804):
318 % pdfTeX versions are available at
319 % ftp://ftp.cstug.cz/pub/tex/local/cstug/thanh/pdftex/snapshots/
320 % Unpack the latest .tgz file:
321 % > tar xzf pdftex-20010804.tgz
322 % Enable encryption support:
323 % src> cd src/texk/web2c/pdftexdir
324 % src/texk/web2c/pdftexdir> ln -fs pdfcrypt-full.c pdfcrypt.c
325 % Compile:
326 % src/texk/web2c/pdftexdir> cd ../../..
327 % src> ./configure
328 % src> cd texk/web2c
329 % src/texk/web2c> make pdftexbin
330 % At last install the binary and pool files.
331 %\end{verbatim}
332 %
333 % \StopEventually{
334 % }
335 %
336 % \section{Implementation}
337 %
338 % \begin{macrocode}
339 %<*package>
340 % \end{macrocode}
341 %
342 % \subsection{Help macros for \plainTeX}
343 %
344 % \begin{macrocode}
345 \expandafter\edef\csname pc@endinput\endcsname{%
346 \catcode`\noexpand\@=\the\catcode`\@\relax
347 \noexpand\endinput
348 }
349 \catcode`\@=11 %
350
351 \expandafter\ifx\csname @firstoftwo\endcsname\relax
352 \long\def\@firstoftwo#1#2{#1}%
353 \fi
354
355 \expandafter\ifx\csname @secondoftwo\endcsname\relax
356 \long\def\@secondoftwo#1#2{#2}%
357 \fi
358
359 \expandafter\ifx\csname @ifundefined\endcsname\relax
360 \def\@ifundefined#1{%
361 \expandafter\ifx\csname #1\endcsname\relax
362 \expandafter\@firstoftwo
363 \else
364 \expandafter\@secondoftwo
365 \fi
366 }%
367 \fi
368
369 \@ifundefined{@ifnextchar}{%
370 \long\def\@ifnextchar#1#2#3{%
371 \let\reserved@d=#1%
372 \def\reserved@a{#2}%
373 \def\reserved@b{#3}%
374 \futurelet\@let@token\@ifnch
375 }%
376 \def\@ifnch{%
377 \ifx\@let@token\@sptoken
378 \let\reserved@c\@xifnch
379 \else
380 \ifx\@let@token\reserved@d
381 \let\reserved@c\reserved@a
382 \else
383 \let\reserved@c\reserved@b
384 \fi
385 \fi
386 \reserved@c
387 }%
388 \begingroup
389 \def\:{\global\let\@sptoken= }%
390 \: %
391 \def\:{\@xifnch}%
392 \expandafter\gdef\: {\futurelet\@let@token\@ifnch}%
393 \endgroup
394 }{}
395
396 \@ifundefined{ProvidesPackage}{%
397 \def\ProvidesPackage#1{%
398 \@ifnextchar[{\pc@ProvidesPackage{#1}}%
399 {\pc@ProvidesPackage{#1}[]}%
400 }%
401 \def\pc@ProvidesPackage#1[#2]{%
402 \immediate\write-1{Package: #1 #2}%
403 }%
404 }{}
405
406 \begingroup\expandafter\expandafter\expandafter\endgroup
407 \expandafter\ifx\csname RequirePackage\endcsname\relax
408 \input infwarerr.sty\relax
409 \else
410 \RequirePackage{infwarerr}%
411 \fi
412
413 \@ifundefined{@gobble}{%
414 \long\def\@gobble#1{}%
415 }{}
416
417 \@ifundefined{@empty}{%
418 \def\@empty{}%
419 }{}
420 % \end{macrocode}
421 %
422 % \subsection{Package Identification and checks}
423 %
424 % \begin{macrocode}
425 \ProvidesPackage{pdfcrypt}%
426 [2016/05/16 v1.1 Allows the setting of PDF encryption (HO)]%
427 % \end{macrocode}
428 %
429 % \begin{macrocode}
430 \@ifundefined{pdfcryptsetup}{%
431 \let\pdfcryptsetup\@gobble
432 }{%
433 \@PackageWarningNoLine{pdfcrypt}{Package pdfcrypt is already loaded}%
434 \pc@endinput
435 }
436 % \end{macrocode}
437 % Support for \cs{nopdfcrypt}.
438 % \begin{macrocode}
439 \newif\ifpc@nopdfcrypt
440 \ifx Y\nopdfcrypt
441 \@PackageWarningNoLine{pdfcrypt}{%
442 Encryption disabled by \string \nopdfcrypt\space request%
443 }%
444 \global\pc@nopdfcrypttrue
445 \fi
446 % \end{macrocode}
447 %
448 % \subsection{Driver detection}
449 %
450 % \begin{macrocode}
451 \let\pc@driver\@empty
452 \begingroup
453 % pdfTeX detection
454 \@ifundefined{pdfoutput}{%
455 }{%
456 \ifcase\pdfoutput
457 \else
458 \@ifundefined{pdfcrypt}{%
459 \@PackageError{pdfcrypt}{%
460 PDF encryption is not supported with this pdfTeX%
461 }{%
462 Encryption support was added in 0.14h (2001/03/10)\MessageBreak
463 and removed in 1.10a (2003/01/16).%
464 }%
465 \endgroup
466 \pc@endinput
467 }{%
468 \gdef\pc@driver{pdftex}%
469 }%
470 \fi
471 }%
472 % VTeX detection
473 \@ifundefined{OpMode}{%
474 }{%
475 \ifnum\OpMode=1 %
476 \ifnum\@ifundefined{VTeXversion}0\VTeXversion<735 %
477 \@PackageError{pdfcrypt}{%
478 PDF encryption is not supported with this VTeX%
479 }{%
480 You need VTeX 7.35 or higher.%
481 }%
482 \endgroup
483 \pc@endinput
484 \else
485 \gdef\pc@driver{vtex}%
486 \fi
487 \fi
488 }%
489 \endgroup
490 % \end{macrocode}
491 %
492 % \subsection{Load package \xpackage{keyval}}
493 %
494 % \begin{macrocode}
495 \@ifundefined{@makeother}{%
496 \def\@makeother#1{\catcode`#1=12\relax}%
497 }{}
498
499 \@ifundefined{g@addto@macro}{%
500 \long\def\g@addto@macro#1#2{%
501 \begingroup
502 \toks@\expandafter{#1#2}%
503 \xdef#1{\the\toks@}%
504 \endgroup
505 }%
506 }{}
507
508 \@ifundefined{@namedef}{%
509 \def\@namedef#1{\expandafter\def\csname#1\endcsname}%
510 }{}
511
512 \@ifundefined{@nameuse}{%
513 \def\@nameuse#1{\csname #1\endcsname}%
514 }{}
515
516 \def\pc@KeyvalRestore{%
517 \let\pc@KeyvalRestore\@undefined
518 }
519
520 \let\pcOrg@NeedsTeXFormat\NeedsTeXFormat
521 \@ifundefined{NeedsTeXFormat}{%
522 \def\NeedsTeXFormat#1{}%
523 \g@addto@macro\pc@KeyvalRestore{%
524 \let\NeedsTeXFormat\pcOrg@NeedsTeXFormat
525 }%
526 }{}
527
528 \let\pcOrg@DeclareOption\DeclareOption
529 \@ifundefined{DeclareOption}{%
530 \def\DeclareOption#1#2{#2}%
531 \g@addto@macro\pc@KeyvalRestore{%
532 \let\DeclareOption\pcOrg@DeclareOption
533 }%
534 }{}
535
536 \let\pcOrg@ExecuteOptions\ExecuteOptions
537 \@ifundefined{ExecuteOptions}{%
538 \def\ExecuteOptions#1{}%
539 \g@addto@macro\pc@KeyvalRestore{%
540 \let\ExecuteOptions\pcOrg@ExecuteOptions
541 }%
542 }{}
543
544 \let\pcOrg@ProcessOptions\ProcessOptions
545 \@ifundefined{ProcessOptions}{%
546 \def\ProcessOptions{}%
547 \g@addto@macro\pc@KeyvalRestore{%
548 \let\ProcessOptions\pcOrg@ProcessOptions
549 }%
550 }{}%
551
552 \begingroup\expandafter\expandafter\expandafter\endgroup
553 \expandafter\ifx\csname RequirePackage\endcsname\relax
554 \input keyval.sty\relax
555 \else
556 \RequirePackage{keyval}%
557 \fi
558 \pc@KeyvalRestore
559 % \end{macrocode}
560 %
561 % \subsection{Define options}
562 %
563 % \begin{macrocode}
564 \@ifundefined{@dblarg}{%
565 \long\def\@dblarg#1{\@ifnextchar[{#1}{\@xdblarg{#1}}}%
566 \long\def\@xdblarg#1#2{#1[{#2}]{#2}}%
567 }{}
568
569 \newif\ifpc@set
570 \newif\ifpc@print
571 \newif\ifpc@copy
572 \newif\ifpc@edit
573 \newif\ifpc@annotate
574 \newif\ifpc@debug
575 \let\pc@owner\@empty
576 \let\pc@user\@empty
577
578 % default: allow all
579 \pc@printtrue
580 \pc@copytrue
581 \pc@edittrue
582 \pc@annotatetrue
583
584 \edef\pc@temp{\catcode`\noexpand\"=\the\catcode`\"\relax}
585 \@makeother\"
586 \def\pc@set{%
587 \@PackageInfo{pdfcrypt}{%
588 \ifpc@debug
589 \ifx\pc@owner\@empty
590 No owner password%
591 \else
592 Owner password: `\pc@owner'%
593 \fi
594 \MessageBreak
595 \ifx\pc@user\@empty
596 No user password%
597 \else
598 User password: `\pc@user'%
599 \fi
600 \MessageBreak
601 Flags: %
602 \ifpc@print \else no\fi print, %
603 \ifpc@copy \else no\fi copy, %
604 \ifpc@edit \else no\fi edit, %
605 \ifpc@annotate\else no\fi annotate%
606 \MessageBreak
607 \fi
608 \ifpc@nopdfcrypt
609 Encryption is disabled by `\string\nopdfcrypt'%
610 \else
611 Encryption is set for `\pc@driver'%
612 \fi
613 }%
614 \ifpc@nopdfcrypt
615 \else
616 \@ifundefined{pc@set@\pc@driver}{%
617 \ifx\pc@driver\@empty
618 \@PackageError{pdfcrypt}{No driver for encryption %
619 support found}\@ehc
620 \else
621 \@PackageError{pdfcrypt}{Cannot set encryption for %
622 unknown driver `\pc@driver'}\@ehc
623 \fi
624 }{%
625 \@nameuse{pc@set@\pc@driver}%
626 }%
627 \fi
628 }
629 \def\pc@set@pdftex{%
630 \ifnum\pdftexversion<100 %
631 \pc@set@pdftexold
632 \else
633 \pc@set@pdftexnew
634 \fi
635 }
636 \def\pc@set@pdftexold{%
637 \pdfcrypt{%
638 owner "\pc@owner" %
639 user "\pc@user" %
640 \ifpc@print \else no\fi print %
641 \ifpc@copy \else no\fi copy %
642 \ifpc@edit \else no\fi edit %
643 \ifpc@annotate\else no\fi annotate%
644 }%
645 }
646 \def\pc@set@pdftexnew{%
647 \pdfcrypt
648 owner{\pc@owner}%
649 user{\pc@user}%
650 \ifpc@print \else no\fi print %
651 \ifpc@copy \else no\fi copy %
652 \ifpc@edit \else no\fi edit %
653 \ifpc@annotate\else no\fi annotate%
654 \relax
655 }
656 \def\pc@set@vtex{%
657 \immediate\special{!security %
658 O=\pc@MakeVTeXString\pc@owner,%
659 U=\pc@MakeVTeXString\pc@user,%
660 P\ifpc@print +\else -\fi,%
661 C\ifpc@copy +\else -\fi,%
662 M\ifpc@edit +\else -\fi,%
663 A\ifpc@annotate +\else -\fi
664 }%
665 }
666 \def\pc@MakeVTeXString#1{%
667 "\expandafter\pc@@MakeVTeXString#1"\@nil"%
668 }
669 \def\pc@@MakeVTeXString#1"#2\@nil{%
670 #1%
671 \ifx\\#2\\%
672 \else
673 ""%
674 \@ReturnAfterFi{%
675 \pc@@MakeVTeXString#2\@nil
676 }%
677 \fi
678 }
679 \long\def\@ReturnAfterFi#1\fi{\fi#1}
680 \pc@temp
681
682 \begingroup
683 \catcode`\ =12 \gdef\pc@spaceother{ }\catcode`\ =10\relax
684 \catcode`\|=0 %
685 \catcode`\\=12 %
686 |gdef|pc@DefString#1#2{%
687 |def#1{#2}%
688 |edef#1{|expandafter|strip@prefix|meaning#1}%
689 |edef#1{|expandafter|pc@SpaceToOther#1 |@nil}%
690 |edef#1{|expandafter|pc@EscapeRemove#1|@empty\|@empty|@nil}%
691 }%
692 |gdef|pc@EscapeRemove#1\#2#3|@nil{%
693 #1#2%
694 |ifx|\#3|\%%
695 |else
696 |@ReturnAfterFi{%
697 |pc@EscapeRemove#3|@nil
698 }%
699 |fi
700 }%
701 |endgroup
702 \def\pc@SpaceToOther#1 #2\@nil{%
703 #1%
704 \ifx\\#2\\%
705 \else
706 \pc@spaceother
707 \@ReturnAfterFi{%
708 \pc@SpaceToOther#2\@nil
709 }%
710 \fi
711 }
712
713 \def\pc@boolkey{\@dblarg\pc@@boolkey}
714 \def\pc@@boolkey[#1]#2#3{%
715 \lowercase{\def\pc@temp{#3}}%
716 \ifx\pc@temp\@empty
717 \let\pc@temp\pc@true
718 \fi
719 \ifx\pc@temp\pc@true
720 \else
721 \ifx\pc@temp\pc@false
722 \else
723 \let\pc@temp\relax
724 \fi
725 \fi
726 \ifx\pc@temp\relax
727 \@PackageWarning{pdfcrypt}{%
728 Unexpected value \string`#3\string' of %
729 option \string`#2\string'\MessageBreak
730 instead of %
731 \string`true\string' or \string`false\string'%
732 }%
733 \else
734 \csname pc@#2\pc@temp\endcsname
735 \fi
736 }
737 \def\pc@true{true}
738 \def\pc@false{false}
739
740 \define@key{pc}{set}[true]{%
741 \pc@boolkey{set}{#1}%
742 }
743 \define@key{pc}{pdftex}[]{%
744 \def\pc@driver{pdftex}%
745 }
746 \define@key{pc}{vtex}[]{%
747 \def\pc@driver{vtex}%
748 }
749 \define@key{pc}{print}[true]{%
750 \pc@boolkey{print}{#1}%
751 }
752 \define@key{pc}{copy}[true]{%
753 \pc@boolkey{copy}{#1}%
754 }
755 \define@key{pc}{edit}[true]{%
756 \pc@boolkey{edit}{#1}%
757 }
758 \define@key{pc}{annotate}[true]{%
759 \pc@boolkey{annotate}{#1}%
760 }
761 \define@key{pc}{all}[]{%
762 \pc@boolkey{print}{true}%
763 \pc@boolkey{copy}{true}%
764 \pc@boolkey{edit}{true}%
765 \pc@boolkey{annotate}{true}%
766 }
767 \define@key{pc}{none}[]{%
768 \pc@boolkey{print}{false}%
769 \pc@boolkey{copy}{false}%
770 \pc@boolkey{edit}{false}%
771 \pc@boolkey{annotate}{false}%
772 }
773
774 \define@key{pc}{owner}{%
775 \pc@DefString\pc@owner{#1}%
776 }
777 \define@key{pc}{user}{%
778 \pc@DefString\pc@user{#1}%
779 }
780 \define@key{pc}{debug}[true]{%
781 \pc@boolkey{debug}{#1}%
782 }
783
784 \def\pdfcryptsetup#1{%
785 \setkeys{pc}{#1}%
786 \ifpc@set
787 \pc@set
788 \global\let\pc@set\relax
789 \gdef\pdfcryptsetup##1{%
790 \@PackageWarning{pdfcrypt}{%
791 Encryption options are already set\MessageBreak
792 new values are ignored%
793 }%
794 }%
795 \fi
796 }
797 \begingroup\expandafter\expandafter\expandafter\endgroup
798 \expandafter\ifx\csname @onlypreamble\endcsname\relax
799 \else
800 \@onlypreamble\pdfcryptsetup
801 \fi
802 % \end{macrocode}
803 %
804 % \subsection{support of configuration file}
805 % \begin{macrocode}
806 \begingroup\expandafter\expandafter\expandafter\endgroup
807 \expandafter\ifx\csname InputIfFileExists\endcsname\relax
808 \@PackageInfo{pdfcrypt}{%
809 Configuration file pdfcrypt.cfg not supported.%
810 }%
811 \else
812 \let\pc@ExecuteOptions\ExecuteOptions
813 \InputIfFileExists{pdfcrypt.cfg}{}{}%
814 \let\ExecuteOptions\pc@ExecuteOptions
815 \fi
816 % \end{macrocode}
817 %
818 % \subsection{Package options}
819 %
820 % Plain format does not know package options.
821 % \begin{macrocode}
822 \begingroup\expandafter\expandafter\expandafter\endgroup
823 \expandafter\ifx\csname @classoptionslist\endcsname\relax
824 \expandafter\pc@endinput
825 \fi
826 % \end{macrocode}
827 % Process global and local options.
828 % \begin{macrocode}
829 \def\pc@ProcessOptionsWithKV{%
830 \let\pc@temp\@empty
831 \@for\CurrentOption:=\@classoptionslist\do{%
832 \@ifundefined{KV@pc@\CurrentOption}{}{%
833 \edef\pc@temp{\pc@temp,\CurrentOption,}%
834 \@expandtwoargs\@removeelement\CurrentOption
835 \@unusedoptionlist\@unusedoptionlist
836 }%
837 }%
838 \edef\pc@temp{%
839 \noexpand\pdfcryptsetup{%
840 \pc@temp\@ptionlist{\@currname.\@currext}%
841 }%
842 }%
843 \pc@temp
844 }
845 \pc@ProcessOptionsWithKV
846 \AtEndOfPackage{\let\@unprocessedoptions\relax}
847 \AtBeginDocument{\pc@set}
848
849 \pc@endinput
850 % \end{macrocode}
851 %
852 % \begin{macrocode}
853 %</package>
854 % \end{macrocode}
855 %
856 % \section{Installation}
857 %
858 % \subsection{Download}
859 %
860 % \paragraph{Package.} This package is available on
861 % CTAN\footnote{\CTANpkg{pdfcrypt}}:
862 % \begin{description}
863 % \item[\CTAN{macros/latex/contrib/oberdiek/pdfcrypt.dtx}] The source file.
864 % \item[\CTAN{macros/latex/contrib/oberdiek/pdfcrypt.pdf}] Documentation.
865 % \end{description}
866 %
867 %
868 % \paragraph{Bundle.} All the packages of the bundle `oberdiek'
869 % are also available in a TDS compliant ZIP archive. There
870 % the packages are already unpacked and the documentation files
871 % are generated. The files and directories obey the TDS standard.
872 % \begin{description}
873 % \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}]
874 % \end{description}
875 % \emph{TDS} refers to the standard ``A Directory Structure
876 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
877 % with \xfile{texmf} in their name are usually organized this way.
878 %
879 % \subsection{Bundle installation}
880 %
881 % \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
882 % TDS tree (also known as \xfile{texmf} tree) of your choice.
883 % Example (linux):
884 % \begin{quote}
885 % |unzip oberdiek.tds.zip -d ~/texmf|
886 % \end{quote}
887 %
888 % \subsection{Package installation}
889 %
890 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
891 % \docstrip\ archive. The files are extracted by running the
892 % \xfile{.dtx} through \plainTeX:
893 % \begin{quote}
894 % \verb|tex pdfcrypt.dtx|
895 % \end{quote}
896 %
897 % \paragraph{TDS.} Now the different files must be moved into
898 % the different directories in your installation TDS tree
899 % (also known as \xfile{texmf} tree):
900 % \begin{quote}
901 % \def\t{^^A
902 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
903 % pdfcrypt.sty & tex/generic/oberdiek/pdfcrypt.sty\\
904 % pdfcrypt.pdf & doc/latex/oberdiek/pdfcrypt.pdf\\
905 % pdfcrypt.dtx & source/latex/oberdiek/pdfcrypt.dtx\\
906 % \end{tabular}^^A
907 % }^^A
908 % \sbox0{\t}^^A
909 % \ifdim\wd0>\linewidth
910 % \begingroup
911 % \advance\linewidth by\leftmargin
912 % \advance\linewidth by\rightmargin
913 % \edef\x{\endgroup
914 % \def\noexpand\lw{\the\linewidth}^^A
915 % }\x
916 % \def\lwbox{^^A
917 % \leavevmode
918 % \hbox to \linewidth{^^A
919 % \kern-\leftmargin\relax
920 % \hss
921 % \usebox0
922 % \hss
923 % \kern-\rightmargin\relax
924 % }^^A
925 % }^^A
926 % \ifdim\wd0>\lw
927 % \sbox0{\small\t}^^A
928 % \ifdim\wd0>\linewidth
929 % \ifdim\wd0>\lw
930 % \sbox0{\footnotesize\t}^^A
931 % \ifdim\wd0>\linewidth
932 % \ifdim\wd0>\lw
933 % \sbox0{\scriptsize\t}^^A
934 % \ifdim\wd0>\linewidth
935 % \ifdim\wd0>\lw
936 % \sbox0{\tiny\t}^^A
937 % \ifdim\wd0>\linewidth
938 % \lwbox
939 % \else
940 % \usebox0
941 % \fi
942 % \else
943 % \lwbox
944 % \fi
945 % \else
946 % \usebox0
947 % \fi
948 % \else
949 % \lwbox
950 % \fi
951 % \else
952 % \usebox0
953 % \fi
954 % \else
955 % \lwbox
956 % \fi
957 % \else
958 % \usebox0
959 % \fi
960 % \else
961 % \lwbox
962 % \fi
963 % \else
964 % \usebox0
965 % \fi
966 % \end{quote}
967 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
968 % TDS installing feature, then some files can already be in the right
969 % place, see the documentation of \docstrip.
970 %
971 % \subsection{Refresh file name databases}
972 %
973 % If your \TeX~distribution
974 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
975 % these. For example, \TeX\,Live\ users run \verb|texhash| or
976 % \verb|mktexlsr|.
977 %
978 % \subsection{Some details for the interested}
979 %
980 % \paragraph{Unpacking with \LaTeX.}
981 % The \xfile{.dtx} chooses its action depending on the format:
982 % \begin{description}
983 % \item[\plainTeX:] Run \docstrip\ and extract the files.
984 % \item[\LaTeX:] Generate the documentation.
985 % \end{description}
986 % If you insist on using \LaTeX\ for \docstrip\ (really,
987 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
988 % about your intention:
989 % \begin{quote}
990 % \verb|latex \let\install=y\input{pdfcrypt.dtx}|
991 % \end{quote}
992 % Do not forget to quote the argument according to the demands
993 % of your shell.
994 %
995 % \paragraph{Generating the documentation.}
996 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
997 % the documentation. The process can be configured by the
998 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
999 % line into this file, if you want to have A4 as paper format:
1000 % \begin{quote}
1001 % \verb|\PassOptionsToClass{a4paper}{article}|
1002 % \end{quote}
1003 % An example follows how to generate the
1004 % documentation with pdf\LaTeX:
1005 % \begin{quote}
1006 %\begin{verbatim}
1007 %pdflatex pdfcrypt.dtx
1008 %makeindex -s gind.ist pdfcrypt.idx
1009 %pdflatex pdfcrypt.dtx
1010 %makeindex -s gind.ist pdfcrypt.idx
1011 %pdflatex pdfcrypt.dtx
1012 %\end{verbatim}
1013 % \end{quote}
1014 %
1015 % \begin{History}
1016 % \begin{Version}{2001/04/02 v0.1}
1017 % \item
1018 % First public version, published in the pdftex
1019 % mailing list for testing with pdfcrypt-20010331
1020 % \end{Version}
1021 % \begin{Version}{2001/07/19 v0.2}
1022 % \item
1023 % Default: all allowed.
1024 % \item
1025 % Support for \VTeX\ added.
1026 % \end{Version}
1027 % \begin{Version}{2001/07/19 v0.3}
1028 % \item
1029 % Bug fix: \VTeX\ letter for edit is M (modify).
1030 % \end{Version}
1031 % \begin{Version}{2001/07/19 v0.4}
1032 % \item
1033 % Bug fix: \cs{VTeXversion} is correct after
1034 % regenerating the format file.
1035 % \end{Version}
1036 % \begin{Version}{2001/08/05 v0.5}
1037 % \item
1038 % Syntax change in \pdfTeX\ 1.00a.
1039 % \end{Version}
1040 % \begin{Version}{2001/08/09 v0.6}
1041 % \item
1042 % Support of special characters:\\
1043 % input: |\{|, |\}|, |\\| for |{|, |}|, |\|\\
1044 % output: |"| in \VTeX
1045 % \item
1046 % Option debug added.
1047 % \end{Version}
1048 % \begin{Version}{2001/10/28 v0.7}
1049 % \item
1050 % Plain compatibility.
1051 % \item
1052 % \cs{nopdfcrypt} added.
1053 % \item
1054 % Typos corrected.
1055 % \end{Version}
1056 % \begin{Version}{2006/02/20 v0.8}
1057 % \item
1058 % Obsolete remarks for \pdfTeX.
1059 % \item
1060 % DTX framework.
1061 % \item
1062 % LPPL 1.3
1063 % \end{Version}
1064 % \begin{Version}{2007/04/11 v0.9}
1065 % \item
1066 % Line ends sanitized.
1067 % \end{Version}
1068 % \begin{Version}{2007/04/26 v1.0}
1069 % \item
1070 % Use of package \xpackage{infwarerr}.
1071 % \end{Version}
1072 % \begin{Version}{2016/05/16 v1.1}
1073 % \item
1074 % Documentation updates.
1075 % \end{Version}
1076 % \end{History}
1077 %
1078 % \PrintIndex
1079 %
1080 % \Finale
1081 \endinput