diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/embedfile.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/embedfile.dtx | 144 |
1 files changed, 134 insertions, 10 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx b/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx index 3e0236455e8..9f0879785bb 100644 --- a/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/embedfile.dtx @@ -75,7 +75,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: embedfile 2007/10/28 v2.0 embed files into PDF (HO)} +\Msg{* Package: embedfile 2007/10/29 v2.1 embed files into PDF (HO)} \Msg{************************************************************************} \keepsilent @@ -146,7 +146,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{embedfile.drv}% - [2007/10/28 v2.0 embed files into PDF (HO)]% + [2007/10/29 v2.1 embed files into PDF (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc}[2007/10/21] \begin{document} @@ -155,7 +155,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{1223} +% \CheckSum{1287} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -176,7 +176,7 @@ and the derived files % \GetFileInfo{embedfile.drv} % % \title{The \xpackage{embedfile} package} -% \date{2007/10/28 v2.0} +% \date{2007/10/29 v2.1} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -282,6 +282,10 @@ and the derived files % \item[\xoption{\meta{key}.prefix}] % Sets the prefix of a collection item property, % see section \ref{sec:collection}. +% \item[\xoption{id}] +% The value must be an unique name. Macros +% \cs{embedfileifobjectexists} and \cs{embedfilegetobject} +% are using this name later. % \end{description} % % \begin{declcs}{embedfilefinish} @@ -402,6 +406,46 @@ and the derived files % Its value is either \texttt{ascending} or \texttt{descending}. % The default is \texttt{ascending}. % +% \subsection{Export of object references} +% +% Caution: This feature is still experimental. It may be even removed +% in future versions. Therefore feedback would be nice, if someone +% has a useful application for this feature. +% +% Object numbers are saved, if \xoption{id} is given in \cs{embedfile}. +% The following objects are supported: +% \begin{itemize} +% \item \texttt{EmbeddedFile} +% \item \texttt{Filespec} +% \end{itemize} +% +% \begin{declcs}{embedfileifobjectexists} \M{id} \M{type} +% \M{then} \M{else} +% \end{declcs} +% Macro \cs{embedfileifobjectexists} tests whether object of \meta{type} +% is available for the embedded file identified by \meta{id}. +% +% \begin{declcs}{embedfilegetobject} \M{id} \M{type} +% \end{declcs} +% Macro \cs{embedfilegetobject} expands to the full object reference +% object of \meta{type} for the embedded file identified by \meta{id}. +% +% \subsubsection{Example} +% +%\begin{quote} +%\begin{verbatim} +%\embedfile[id={foo}]{foo.pdf} +%\embedfileifobjectexists{foo}{Filespec}{% +% \typeout{% +% FileSpec object for `foo': % +% \embedfilegetobject{foo}{Filespec}% +% }% +%}{% +% \typeout{No Filespec object for `foo'}% +%} +%\end{verbatim} +%\end{quote} +% % \subsection{Examples} % \label{sec:examples} % @@ -465,7 +509,7 @@ This example document contains three embedded files. \usepackage[bookmarks=false]{hyperref} % provides \pdfstringdef that is then used by `title' and % other keys. -\usepackage{embedfile}[2007/10/28] +\usepackage{embedfile}[2007/10/29] \embedfilesetup{ view=details, initialfile=embedfile.pdf @@ -533,8 +577,8 @@ You need Acrobat Reader 8 or higher. %<*dtxattach> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{dtx-attach} - [2007/10/28 v2.0 Embed \string\jobname.dtx (HO)]% -\RequirePackage{embedfile}[2007/10/28] + [2007/10/29 v2.1 Embed \string\jobname.dtx (HO)]% +\RequirePackage{embedfile}[2007/10/29] \embedfile[% stringmethod=escape,% mimetype=plain/text,% @@ -610,7 +654,7 @@ You need Acrobat Reader 8 or higher. \fi \expandafter\x\csname ver@embedfile.sty\endcsname \ProvidesPackage{embedfile}% - [2007/10/28 v2.0 embed files into PDF (HO)] + [2007/10/29 v2.1 embed files into PDF (HO)] % \end{macrocode} % % \subsection{Catcodes} @@ -823,6 +867,11 @@ You need Acrobat Reader 8 or higher. \newif\ifEmFi@finished % \end{macrocode} % \end{macro} +% \begin{macro}{\ifEmFi@id} +% \begin{macrocode} +\newif\ifEmFi@id +% \end{macrocode} +% \end{macro} % % \subsection{Key value definitions} % @@ -983,6 +1032,61 @@ You need Acrobat Reader 8 or higher. } % \end{macrocode} % +% Option \xoption{id} as key for object numbers. +% \begin{macrocode} +\define@key{EmFi}{id}{% + \def\EmFi@id{#1}% + \EmFi@idtrue +} +% \end{macrocode} +% \begin{macro}{\EmFi@defobj} +% \begin{macrocode} +\def\EmFi@defobj#1{% + \ifEmFi@id + \expandafter\xdef\csname EmFi@#1@\EmFi@id\endcsname{% + \the\pdflastobj\space 0 R% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\embedfileifobjectexists} +% \begin{macrocode} +\def\embedfileifobjectexists#1#2{% + \expandafter\ifx\csname EmFi@#2@#1\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@firstoftwo} +% \begin{macrocode} +\expandafter\ifx\csname @firstoftwo\endcsname\relax + \long\def\@firstoftwo#1#2{#1}% +\fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@secondoftwo} +% \begin{macrocode} +\expandafter\ifx\csname @secondoftwo\endcsname\relax + \long\def\@secondoftwo#1#2{#2}% +\fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\embedfilegetobject} +% \begin{macrocode} +\def\embedfilegetobject#1#2{% + \embedfileifobjectexists{#1}{#2}{% + \csname EmFi@#2@#1\endcsname + }{% + 0 0 R% + }% +} +% \end{macrocode} +% \end{macro} +% % Initial view of the collection. % \begin{macrocode} \define@key{EmFi}{view}[]{% @@ -1327,6 +1431,7 @@ You need Acrobat Reader 8 or higher. /CheckSum<\pdfmdfivesum file{\EmFi@file}>% >>% }file{\EmFi@file}\relax + \EmFi@defobj{EmbeddedFile}% \immediate\pdfobj{% <<% /Type/Filespec% @@ -1347,6 +1452,7 @@ You need Acrobat Reader 8 or higher. \fi >>% }% + \EmFi@defobj{Filespec}% \EmFi@add{% \EmFi@@filespec }{\the\pdflastobj\space 0 R}% @@ -1605,10 +1711,23 @@ You need Acrobat Reader 8 or higher. \embedfile[% stringmethod=escape,% mimetype=plain/text,% - desc={LaTeX docstrip source archive for package `embedfile'}% + desc={LaTeX docstrip source archive for package `embedfile'},% + id={embedfile.dtx}% ]{embedfile.dtx} \nopagenumbers Test (plain-\TeX): {\tt embedfile.dtx} should be embedded.% + +\def\Test#1{% + \par + \embedfileifobjectexists{embedfile.dtx}{#1}{% + Object #1 (embedfile.dtx): % + \embedfilegetobject{embedfile.dtx}{#1}% + }{% + \errmessage{Missing object #1 (embedfile.dtx)}% + }% +} +\Test{EmbeddedFile} +\Test{Filespec} \embedfilefinish \bye %</test2> @@ -1618,7 +1737,7 @@ Test (plain-\TeX): {\tt embedfile.dtx} should be embedded.% \NeedsTeXFormat{LaTeX2e} \let\SavedJobname\jobname \def\jobname{embedfile} -\RequirePackage{dtx-attach}[2007/10/28] +\RequirePackage{dtx-attach}[2007/10/29] \let\jobname\SavedJobname \documentclass{minimal} \begin{document} @@ -1862,6 +1981,11 @@ Test (plain-\TeX): {\tt embedfile.dtx} should be embedded.% % \item % Collection support added (PDF 1.7). % \end{Version} +% \begin{Version}{2007/10/29 v2.1} +% \item +% Export of object references by adding new option \xoption{id} and +% new macros \cs{embedfileifobjectexists} and \cs{embedfilegetobject}. +% \end{Version} % \end{History} % % \PrintIndex |