[pdftex] pdftex-pdfcrypt update 31/03

Heiko Oberdiek oberdiek at ruf.uni-freiburg.de
Mon Apr 2 12:29:18 CEST 2001


At 14:28 31.03.2001 +0200, Ricardo Sanchez Carmenes wrote:
>
>The pdfcrypt version of pdftex has been updated:
>
>31/03/2001 a number of bugs, mainly shown by Heiko Oberdiek, fixed:

What will be the result of the discussion about the syntax of
the \pdfcrypt primitive?

For testing, I have written a LaTeX package for support of
the new \pdfcrypt primitive:

%%% cut %%% pdfcrypt.sty %%% cut %%%
% File:      pdfcrypt.sty
% Version:   2001/04/02 v0.1
% Author:    Heiko Oberdiek
% Email:     <oberdiek at ruf.uni-freiburg.de>
%
% Copyright: Copyright (C) 2001 Heiko Oberdiek.
%
%            This program may be distributed and/or modified under
%            the conditions of the LaTeX Project Public License,
%            either version 1.2 of this license or (at your option)
%            any later version. The latest version of this license
%            is in
%              http://www.latex-project.org/lppl.txt
%            and version 1.2 or later is part of all distributions
%            of LaTeX version 1999/12/01 or later.
%
% Function:  This package provides an interface to the new
%            pdfTeX primitive \pdfcrypt, implemented by
%            Ricardo Sanchez Carmenes <carmenes at bioquimica.uniovi.es>.
%
% Required:  pdfTeX-0.14h-pdfcrypt-20010310, pdfcrypt-20010331
%
% Use:       The options can be set as package options or
%            in the command \pdfcryptsetup:
%              owner=OwnerPassword
%              user=UserPassword
%              print, copy, edit, annotate=true, false
%              all, none
%            Example:
%              \usepackage[owner=Donald,user=Knuth,none,print]{pdfcrypt}
%
% History:   2001/04/02 v0.1:
%              First public version, published in the pdftex
%              mailing list for testing with pdfcrypt-20010331

\ProvidesPackage{pdfcrypt}%
  [2001/04/02 v0.1 Interface for setting pdf encryption (HO)]

\typeout{*********************************************************}
\typeout{* Caution: This is a test version for pdfcrypt-20010331 *}
\typeout{*********************************************************}

\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfcrypt\endcsname\relax
  \PackageError{pdfcrypt}{%
    PDF encryption is not supported%
  }{%
    You need pdfTeX 3.14159-14h-pdfcrypt-20010310 or higher.%
  }%
  \expandafter\endinput
\fi

\RequirePackage{keyval}

\newif\ifpc at print
\newif\ifpc at copy
\newif\ifpc at edit
\newif\ifpc at annotate
\let\pc at owner\@empty
\let\pc at user\@empty

\edef\pc at temp{\catcode`\noexpand\"=\the\catcode`\"\relax}
\@makeother\"
\def\pc at set{%
  \pdfcrypt{%
    owner "\pc at owner"
    user "\pc at user"
    \ifpc at print   \else no\fi print
    \ifpc at copy    \else no\fi copy
    \ifpc at edit    \else no\fi edit
    \ifpc at annotate\else no\fi annotate%
  }%
}
\pc at temp

\def\pc at boolkey{\@dblarg\pc@@boolkey}
\def\pc@@boolkey[#1]#2#3{%
  \lowercase{\def\pc at temp{#3}}%
  \ifx\pc at temp\@empty
    \let\pc at temp\pc at true
  \fi
  \ifx\pc at temp\pc at true
  \else
    \ifx\pc at temp\pc at false
    \else
      \let\pc at temp\relax
    \fi
  \fi
  \ifx\pc at temp\relax
    \PackageWarning{pdfcrypt}{%
      Unexpected value \string`#3\string' of
      option \string`#2\string'\MessageBreak
      instead of
      \string`true\string' or \string`false\string'%
    }%
  \else
    \csname pc@#2\pc at temp\endcsname
  \fi
}
\def\pc at true{true}
\def\pc at false{false}

\define at key{pc}{print}[true]{%
  \pc at boolkey{print}{#1}%
}
\define at key{pc}{copy}[true]{%
  \pc at boolkey{copy}{#1}%
}
\define at key{pc}{edit}[true]{%
  \pc at boolkey{edit}{#1}%
}
\define at key{pc}{annotate}[true]{%
  \pc at boolkey{annotate}{#1}%
}
\define at key{pc}{all}[]{%
  \pc at boolkey{print}{true}%
  \pc at boolkey{copy}{true}%
  \pc at boolkey{edit}{true}%
  \pc at boolkey{annotate}{true}%
}
\define at key{pc}{none}[]{%
  \pc at boolkey{print}{false}%
  \pc at boolkey{copy}{false}%
  \pc at boolkey{edit}{false}%
  \pc at boolkey{annotate}{false}%
}

\define at key{pc}{owner}{%
  \def\pc at owner{#1}%
}
\define at key{pc}{user}{%
  \def\pc at user{#1}%
}

\newcommand*{\pdfcryptsetup}[1]{%
  \setkeys{pc}{#1}%
  \pc at set
}

% support of configuration file
\let\pc at ExecuteOptions\ExecuteOptions
\InputIfFileExists{pdfcrypt.cfg}{}{}
\let\ExecuteOptions\pc at ExecuteOptions

% process global and local options
\def\pc at ProcessOptionsWithKV{%
  \let\pc at temp\@empty
  \@for\CurrentOption:=\@classoptionslist\do{%
    \@ifundefined{KV at pc@\CurrentOption}{}{%
      \edef\pc at temp{\pc at temp,\CurrentOption,}%
      \@expandtwoargs\@removeelement\CurrentOption
        \@unusedoptionlist\@unusedoptionlist
    }%
  }%
  \edef\pc at temp{%
    \noexpand\pdfcryptsetup{%
      \pc at temp\@ptionlist{\@currname.\@currext}%
    }%
  }%
  \pc at temp
}
\pc at ProcessOptionsWithKV
\AtEndOfPackage{\let\@unprocessedoptions\relax}

\endinput
%%% cut %%% pdfcrypt.sty %%% cut %%%

Yours sincerely
  Heiko <oberdiek at ruf.uni-freiburg.de>



More information about the pdftex mailing list