summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/oberdiek/embedfile.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-08-27 22:38:54 +0000
committerKarl Berry <karl@freefriends.org>2006-08-27 22:38:54 +0000
commit2607d53137ede06e9780342b225218743e100bb4 (patch)
treec6c88c805dd21a5bbb6ad6f26d3d53c517f4b866 /Master/texmf-dist/tex/latex/oberdiek/embedfile.sty
parentfb0d58de45c0fc32bab09a839c186de46f75628e (diff)
oberdiek update from tds zip (28aug06)
git-svn-id: svn://tug.org/texlive/trunk@2054 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/oberdiek/embedfile.sty')
-rw-r--r--Master/texmf-dist/tex/latex/oberdiek/embedfile.sty308
1 files changed, 308 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/oberdiek/embedfile.sty b/Master/texmf-dist/tex/latex/oberdiek/embedfile.sty
new file mode 100644
index 00000000000..6376f224799
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/oberdiek/embedfile.sty
@@ -0,0 +1,308 @@
+%%
+%% This is file `embedfile.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% embedfile.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2006 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 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.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Heiko Oberdiek.
+%%
+%% This work consists of the main source file embedfile.dtx
+%% and the derived files
+%% embedfile.sty, embedfile.pdf, embedfile.ins, embedfile.drv,
+%% dtx-attach.sty, embedfile-example-plain.tex.
+%%
+\begingroup
+ \expandafter\let\expandafter\x\csname ver@embedfile.sty\endcsname
+ \ifcase 0%
+ \ifx\x\relax % plain
+ \else
+ \ifx\x\empty % LaTeX
+ \else
+ 1%
+ \fi
+ \fi
+ \else
+ \expandafter\ifx\csname PackageInfo\endcsname\relax
+ \def\x#1#2{%
+ \immediate\write-1{Package #1 Info: #2.}%
+ }%
+ \else
+ \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
+ \fi
+ \x{embedfile}{The package is already loaded}%
+ \endgroup
+ \expandafter\endinput
+ \fi
+\endgroup
+\begingroup
+ \expandafter\ifx\csname ProvidesPackage\endcsname\relax
+ \def\x#1#2#3[#4]{\endgroup
+ \immediate\write-1{Package: #3 #4}%
+ \xdef#1{#4}%
+ }%
+ \else
+ \def\x#1#2[#3]{\endgroup
+ #2[{#3}]%
+ \ifx#1\relax
+ \xdef#1{#3}%
+ \fi
+ }%
+ \fi
+\expandafter\x\csname ver@embedfile.sty\endcsname
+\ProvidesPackage{embedfile}%
+ [2006/08/16 v1.0 embed files into PDF (HO)]
+\edef\EmbedFileRestoreCatcodes{%
+ \catcode39 \the\catcode39 % '
+ \catcode40 \the\catcode40 % (
+ \catcode41 \the\catcode41 % )
+ \catcode47 \the\catcode47 % /
+ \catcode60 \the\catcode60 % <
+ \catcode62 \the\catcode62 % >
+ \catcode64 \the\catcode64 % @
+ \catcode91 \the\catcode91 % [
+ \catcode93 \the\catcode93 % ]
+ \catcode96 \the\catcode96 % `
+}
+\catcode39 12 % '
+\catcode40 12 % (
+\catcode41 12 % )
+\catcode47 12 % /
+\catcode60 12 % <
+\catcode62 12 % >
+\catcode64 11 % @
+\catcode91 12 % [
+\catcode93 12 % ]
+\catcode96 12 % `
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname PackageError\endcsname\relax
+ \def\EmbedFile@PackageError#1#2{%
+ \errhelp{#2}%
+ \errmessage{Package embedfile Error: #1.}%
+ }%
+\else
+ \def\EmbedFile@PackageError#1#2{%
+ \begingroup
+ \let\on@line\empty
+ \PackageError{embedfile}{#1}{#2}%
+ \endgroup
+ }%
+\fi
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \def\EmbedFile@RequirePackage#1#2{%
+ \expandafter\ifx\csname #2\encsname\relax
+ \input #1.sty\relax
+ \fi
+ }%
+\else
+ \def\EmbedFile@RequirePackage#1#2{%
+ \expandafter\ifx\csname #2\endcsname\relax
+ \RequirePackage{#1}%
+ \fi
+ }%
+\fi
+\EmbedFile@RequirePackage{ifpdf}{ifpdf}
+\ifpdf
+\else
+ \EmbedFile@PackageError{%
+ Missing pdfTeX in PDF mode%
+ }{%
+ Currently other drivers are not supported. Package loading is aborted.%
+ }%
+ \EmbedFileRestoreCatcodes
+ \expandafter\endinput
+\fi
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname pdffilesize\endcsname\relax
+ \EmbedFile@PackageError{%
+ Unsupported pdfTeX version%
+ }{%
+ At least version 1.30 is necessary. Package loading is aborted.%
+ }%
+ \EmbedFileRestoreCatcodes
+ \expandafter\endinput
+\fi
+\EmbedFile@RequirePackage{keyval}{define@key}
+\def\EmbedFile@DefineKey#1#2{%
+ \define@key{EmbedFile}{#1}{%
+ \expandafter\def\csname EmbedFile@#1\endcsname{##1}%
+ }%
+ \expandafter\def\csname EmbedFile@#1\endcsname{#2}%
+}
+\EmbedFile@DefineKey{mimetype}{}
+\EmbedFile@DefineKey{filespec}{\EmbedFile@file}
+\EmbedFile@DefineKey{filesystem}{}
+\EmbedFile@DefineKey{desc}{}
+\EmbedFile@DefineKey{stringmethod}{%
+ \ifx\pdfstringdef\@undefined
+ escape%
+ \else
+ \ifx\pdfstringdef\relax
+ escape%
+ \else
+ psd%
+ \fi
+ \fi
+}
+\def\embedfilesetup{%
+ \setkeys{EmbedFile}%
+}
+\def\embedfile{%
+ \@ifnextchar[\EmbedFile@embedfile{\EmbedFile@embedfile[]}%
+}
+\def\EmbedFile@embedfile[#1]#2{%
+ \ifEmbedFile@finished
+ \EmbedFile@PackageError{%
+ \string\embedfile\space after \string\embedfilefinish
+ }{%
+ The list of embedded files is already written.%
+ }%
+ \else
+ \begingroup
+ \def\EmbedFile@file{#2}%
+ \setkeys{EmbedFile}{#1}%
+ \expandafter\ifx\expandafter\\\pdffilesize{\EmbedFile@file}\\%
+ \EmbedFile@PackageError{%
+ File `\EmbedFile@file' not found%
+ }{%
+ The unknown file is not embedded.%
+ }%
+ \else
+ \EmbedFile@convert\EmbedFile@filespec\EmbedFile@@filespec
+ \ifx\EmbedFile@desc\empty
+ \let\EmbedFile@@desc\empty
+ \else
+ \EmbedFile@convert\EmbedFile@desc\EmbedFile@@desc
+ \fi
+ \immediate\pdfobj stream attr{%
+ /Type/EmbeddedFile%
+ \ifx\EmbedFile@mimetype\empty
+ \else
+ /Subtype/\pdfescapename{\EmbedFile@mimetype}%
+ \fi
+ /Params<<%
+ /ModDate(\pdffilemoddate{\EmbedFile@file})%
+ /Size \pdffilesize{\EmbedFile@file}%
+ /CheckSum<\pdfmdfivesum file{\EmbedFile@file}>%
+ >>%
+ }file{\EmbedFile@file}\relax
+ \immediate\pdfobj{%
+ <<%
+ /Type/Filespec%
+ \ifx\EmbedFile@filesystem\empty
+ \else
+ /FS/\pdfescapename{\EmbedFile@filesystem}%
+ \fi
+ /F(\EmbedFile@@filespec)%
+ \ifx\EmbedFile@@desc\empty
+ \else
+ /Desc(\EmbedFile@@desc)%
+ \fi
+ /EF<<%
+ /F \the\pdflastobj\space 0 R%
+ >>%
+ >>%
+ }%
+ \EmbedFile@add{%
+ \EmbedFile@@filespec
+ }{\the\pdflastobj\space 0 R}%
+ \fi
+ \endgroup
+ \fi
+}
+\def\EmbedFile@convert#1#2{%
+ \ifnum\pdfstrcmp{\EmbedFile@stringmethod}{psd}=0 %
+ \pdfstringdef\EmbedFile@temp{#1}%
+ \let#2\EmbedFile@temp
+ \else
+ \edef#2{\pdfescapestring{#1}}%
+ \fi
+}
+\global\let\EmbedFile@list\empty
+\def\EmbedFile@add#1#2{%
+ \begingroup
+ \edef\key{\pdfescapehex{#1}}%
+ \ifx\EmbedFile@list\empty
+ \xdef\EmbedFile@list{\noexpand\do{\key}{#2}}%
+ \else
+ \def\do##1##2{%
+ \ifnum\pdfstrcmp{##1}{\key}>0 %
+ \edef\x{%
+ \toks@{%
+ \the\toks@%
+ \noexpand\do{\key}{#2}%
+ \noexpand\do{##1}{##2}%
+ }%
+ }%
+ \x
+ \def\do####1####2{%
+ \toks@\expandafter{\the\toks@\do{####1}{####2}}%
+ }%
+ \def\stop{%
+ \xdef\EmbedFile@list{\the\toks@}%
+ }%
+ \else
+ \toks@\expandafter{\the\toks@\do{##1}{##2}}%
+ \fi
+ }%
+ \def\stop{%
+ \xdef\EmbedFile@list{\the\toks@\noexpand\do{\key}{#2}}%
+ }%
+ \toks@{}%
+ \EmbedFile@list\stop
+ \fi
+ \endgroup
+}
+\newif\ifEmbedFile@finished
+\def\embedfilefinish{%
+ \ifEmbedFile@finished
+ \EmbedFile@PackageError{%
+ Too many invocations of \string\embedfilefinish
+ }{%
+ The list of embedded files is already written.%
+ }%
+ \else
+ \ifx\EmbedFile@list\empty
+ \else
+ \global\EmbedFile@finishedtrue
+ \begingroup
+ \def\do##1##2{%
+ <##1>##2%
+ }%
+ \immediate\pdfobj{%
+ <<%
+ /Names[\EmbedFile@list]%
+ >>%
+ }%
+ \pdfnames{%
+ /EmbeddedFiles \the\pdflastobj\space 0 R%
+ }%
+ \endgroup
+ \fi
+ \fi
+}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname AtEndDocument\endcsname\relax
+\else
+ \AtEndDocument{\embedfilefinish}%
+\fi
+\EmbedFileRestoreCatcodes
+\endinput
+%%
+%% End of file `embedfile.sty'.