Anzahlungs-Rg.: Buchen auf Verrechnungskonto ohne Steuer
[kivitendo-erp.git] / texmf / embedfile.sty
1 %% !!NOTE NOTE NOTE!!
2 %%
3 %% This is a modified version of `embedfile.sty' generated from a
4 %% modified `embedfile.dtx' incorporating the following pull request:
5 %% https://github.com/ho-tex/oberdiek/pull/72
6 %%
7 %% This PR adds support for creating PDF/A-compliant attachments. See
8 %% also the following issue:
9 %% https://github.com/ho-tex/oberdiek/issues/37
10 %%
11 %% !!END OF NOTE NOTE NOTE!!
12 %%
13 %%
14 %% This is file `embedfile.sty',
15 %% generated with the docstrip utility.
16 %%
17 %% The original source files were:
18 %%
19 %% embedfile.dtx  (with options: `package')
20 %%
21 %% This is a generated file.
22 %%
23 %% Project: embedfile
24 %% Version: 2018/11/01 v2.8
25 %%
26 %% Copyright (C) 2006-2011 by
27 %%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
28 %%
29 %% This work may be distributed and/or modified under the
30 %% conditions of the LaTeX Project Public License, either
31 %% version 1.3c of this license or (at your option) any later
32 %% version. This version of this license is in
33 %%    http://www.latex-project.org/lppl/lppl-1-3c.txt
34 %% and the latest version of this license is in
35 %%    http://www.latex-project.org/lppl.txt
36 %% and version 1.3 or later is part of all distributions of
37 %% LaTeX version 2005/12/01 or later.
38 %%
39 %% This work has the LPPL maintenance status "maintained".
40 %%
41 %% This Current Maintainer of this work is Heiko Oberdiek.
42 %%
43 %% The Base Interpreter refers to any `TeX-Format',
44 %% because some files are installed in TDS:tex/generic//.
45 %%
46 %% This work consists of the main source file embedfile.dtx
47 %% and the derived files
48 %%    embedfile.sty, embedfile.pdf, embedfile.ins, embedfile.drv,
49 %%    dtx-attach.sty, embedfile-example-plain.tex,
50 %%    embedfile-example-collection.tex, embedfile-test1.tex,
51 %%    embedfile-test2.tex, embedfile-test3.tex,
52 %%    embedfile-test4.tex.
53 %%
54 \begingroup\catcode61\catcode48\catcode32=10\relax%
55   \catcode13=5 % ^^M
56   \endlinechar=13 %
57   \catcode35=6 % #
58   \catcode39=12 % '
59   \catcode44=12 % ,
60   \catcode45=12 % -
61   \catcode46=12 % .
62   \catcode58=12 % :
63   \catcode64=11 % @
64   \catcode123=1 % {
65   \catcode125=2 % }
66   \expandafter\let\expandafter\x\csname ver@embedfile.sty\endcsname
67   \ifx\x\relax % plain-TeX, first loading
68   \else
69     \def\empty{}%
70     \ifx\x\empty % LaTeX, first loading,
71       % variable is initialized, but \ProvidesPackage not yet seen
72     \else
73       \expandafter\ifx\csname PackageInfo\endcsname\relax
74         \def\x#1#2{%
75           \immediate\write-1{Package #1 Info: #2.}%
76         }%
77       \else
78         \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
79       \fi
80       \x{embedfile}{The package is already loaded}%
81       \aftergroup\endinput
82     \fi
83   \fi
84 \endgroup%
85 \begingroup\catcode61\catcode48\catcode32=10\relax%
86   \catcode13=5 % ^^M
87   \endlinechar=13 %
88   \catcode35=6 % #
89   \catcode39=12 % '
90   \catcode40=12 % (
91   \catcode41=12 % )
92   \catcode44=12 % ,
93   \catcode45=12 % -
94   \catcode46=12 % .
95   \catcode47=12 % /
96   \catcode58=12 % :
97   \catcode64=11 % @
98   \catcode91=12 % [
99   \catcode93=12 % ]
100   \catcode123=1 % {
101   \catcode125=2 % }
102   \expandafter\ifx\csname ProvidesPackage\endcsname\relax
103     \def\x#1#2#3[#4]{\endgroup
104       \immediate\write-1{Package: #3 #4}%
105       \xdef#1{#4}%
106     }%
107   \else
108     \def\x#1#2[#3]{\endgroup
109       #2[{#3}]%
110       \ifx#1\@undefined
111         \xdef#1{#3}%
112       \fi
113       \ifx#1\relax
114         \xdef#1{#3}%
115       \fi
116     }%
117   \fi
118 \expandafter\x\csname ver@embedfile.sty\endcsname
119 \ProvidesPackage{embedfile}%
120   [2018/11/01 v2.8 Embed files into PDF (HO)]%
121 \begingroup\catcode61\catcode48\catcode32=10\relax%
122   \catcode13=5 % ^^M
123   \endlinechar=13 %
124   \catcode123=1 % {
125   \catcode125=2 % }
126   \catcode64=11 % @
127   \def\x{\endgroup
128     \expandafter\edef\csname EmFi@AtEnd\endcsname{%
129       \endlinechar=\the\endlinechar\relax
130       \catcode13=\the\catcode13\relax
131       \catcode32=\the\catcode32\relax
132       \catcode35=\the\catcode35\relax
133       \catcode61=\the\catcode61\relax
134       \catcode64=\the\catcode64\relax
135       \catcode123=\the\catcode123\relax
136       \catcode125=\the\catcode125\relax
137     }%
138   }%
139 \x\catcode61\catcode48\catcode32=10\relax%
140 \catcode13=5 % ^^M
141 \endlinechar=13 %
142 \catcode35=6 % #
143 \catcode64=11 % @
144 \catcode123=1 % {
145 \catcode125=2 % }
146 \def\TMP@EnsureCode#1#2{%
147   \edef\EmFi@AtEnd{%
148     \EmFi@AtEnd
149     \catcode#1=\the\catcode#1\relax
150   }%
151   \catcode#1=#2\relax
152 }
153 \TMP@EnsureCode{39}{12}% '
154 \TMP@EnsureCode{40}{12}% (
155 \TMP@EnsureCode{41}{12}% )
156 \TMP@EnsureCode{44}{12}% ,
157 \TMP@EnsureCode{46}{12}% .
158 \TMP@EnsureCode{47}{12}% /
159 \TMP@EnsureCode{58}{12}% :
160 \TMP@EnsureCode{60}{12}% <
161 \TMP@EnsureCode{62}{12}% >
162 \TMP@EnsureCode{91}{12}% [
163 \TMP@EnsureCode{93}{12}% ]
164 \TMP@EnsureCode{96}{12}% `
165 \edef\EmFi@AtEnd{\EmFi@AtEnd\noexpand\endinput}
166 \begingroup\expandafter\expandafter\expandafter\endgroup
167 \expandafter\ifx\csname RequirePackage\endcsname\relax
168   \def\EmFi@RequirePackage#1[#2]{%
169     \input #1.sty\relax
170   }%
171 \else
172   \let\EmFi@RequirePackage\RequirePackage
173 \fi
174 \EmFi@RequirePackage{infwarerr}[2007/09/09]%
175 \def\EmFi@Error{%
176   \@PackageError{embedfile}%
177 }
178 \ifx\pdfextension\@undefined\else
179     \protected\def\pdflastobj {\numexpr\pdffeedback lastobj\relax}
180     \protected\def\pdfnames   {\pdfextension names }
181     \protected\def\pdfobj     {\pdfextension obj }
182     \let\pdfoutput            \outputmode
183 \fi
184 \EmFi@RequirePackage{ifpdf}[2007/09/09]
185 \ifpdf
186 \else
187   \EmFi@Error{%
188     Missing pdfTeX in PDF mode%
189   }{%
190     Currently other drivers are not supported. %
191     Package loading is aborted.%
192   }%
193   \expandafter\EmFi@AtEnd
194 \fi%
195 \EmFi@RequirePackage{pdftexcmds}[2007/11/11]
196 \EmFi@RequirePackage{ltxcmds}[2010/03/01]
197 \EmFi@RequirePackage{kvsetkeys}[2010/03/01]
198 \EmFi@RequirePackage{kvdefinekeys}[2010/03/01]
199 \begingroup\expandafter\expandafter\expandafter\endgroup
200 \expandafter\ifx\csname pdf@filesize\endcsname\relax
201   \EmFi@Error{%
202     Unsupported pdfTeX version%
203   }{%
204     At least version 1.30 is necessary. Package loading is aborted.%
205   }%
206   \expandafter\EmFi@AtEnd
207 \fi%
208 \EmFi@RequirePackage{pdfescape}[2007/11/11]
209 \def\EmFi@temp#1{%
210   \expandafter\EdefSanitize\csname EmFi@S@#1\endcsname{#1}%
211 }
212 \EmFi@temp{details}%
213 \EmFi@temp{tile}%
214 \EmFi@temp{hidden}%
215 \EmFi@temp{text}
216 \EmFi@temp{date}
217 \EmFi@temp{number}
218 \EmFi@temp{file}
219 \EmFi@temp{desc}
220 \EmFi@temp{afrelationship}
221 \EmFi@temp{moddate}
222 \EmFi@temp{creationdate}
223 \EmFi@temp{size}
224 \EmFi@temp{ascending}
225 \EmFi@temp{descending}
226 \EmFi@temp{true}
227 \EmFi@temp{false}
228 \ltx@newif\ifEmFi@collection
229 \ltx@newif\ifEmFi@sort
230 \ltx@newif\ifEmFi@visible
231 \ltx@newif\ifEmFi@edit
232 \ltx@newif\ifEmFi@item
233 \ltx@newif\ifEmFi@finished
234 \ltx@newif\ifEmFi@id
235 \def\EmFi@GlobalKey#1#2{%
236   \global\expandafter\let\csname KV@#1@#2\expandafter\endcsname
237                          \csname KV@#1@#2\endcsname
238 }
239 \def\EmFi@GlobalDefaultKey#1#2{%
240   \EmFi@GlobalKey{#1}{#2}%
241   \global\expandafter\let
242       \csname KV@#1@#2@default\expandafter\endcsname
243       \csname KV@#1@#2@default\endcsname
244 }
245 \def\EmFi@DefineKey#1#2{%
246   \kv@define@key{EmFi}{#1}{%
247     \expandafter\def\csname EmFi@#1\endcsname{##1}%
248   }%
249   \expandafter\def\csname EmFi@#1\endcsname{#2}%
250 }
251 \EmFi@DefineKey{mimetype}{}
252 \EmFi@DefineKey{filespec}{\EmFi@file}
253 \EmFi@DefineKey{ucfilespec}{}
254 \EmFi@DefineKey{filesystem}{}
255 \EmFi@DefineKey{desc}{}
256 \EmFi@DefineKey{afrelationship}{}
257 \EmFi@DefineKey{stringmethod}{%
258   \ifx\pdfstringdef\@undefined
259     escape%
260   \else
261     \ifx\pdfstringdef\relax
262       escape%
263     \else
264       psd%
265     \fi
266   \fi
267 }
268 \kv@define@key{EmFi}{id}{%
269   \def\EmFi@id{#1}%
270   \EmFi@idtrue
271 }
272 \def\EmFi@defobj#1{%
273   \ifEmFi@id
274     \expandafter\xdef\csname EmFi@#1@\EmFi@id\endcsname{%
275       \the\pdflastobj\ltx@space 0 R%
276     }%
277   \fi
278 }
279 \def\embedfileifobjectexists#1#2{%
280   \expandafter\ifx\csname EmFi@#2@#1\endcsname\relax
281     \expandafter\ltx@secondoftwo
282   \else
283     \expandafter\ltx@firstoftwo
284   \fi
285 }
286 \def\embedfilegetobject#1#2{%
287   \embedfileifobjectexists{#1}{#2}{%
288     \csname EmFi@#2@#1\endcsname
289   }{%
290     0 0 R%
291   }%
292 }
293 \kv@define@key{EmFi}{view}[]{%
294   \EdefSanitize\EmFi@temp{#1}%
295   \def\EmFi@next{%
296     \global\EmFi@collectiontrue
297   }%
298   \ifx\EmFi@temp\ltx@empty
299     \let\EmFi@view\EmFi@S@details
300   \else\ifx\EmFi@temp\EmFi@S@details
301     \let\EmFi@view\EmFi@S@details
302   \else\ifx\EmFi@temp\EmFi@S@tile
303     \let\EmFi@view\EmFi@S@tile
304   \else\ifx\EmFi@temp\EmFi@S@hidden
305     \let\EmFi@view\EmFi@S@hidden
306   \else
307     \let\EmFi@next\relax
308     \EmFi@Error{%
309       Unknown value `\EmFi@temp' for key `view'.\MessageBreak
310       Supported values: `details', `tile', `hidden'.%
311     }\@ehc
312   \fi\fi\fi\fi
313   \EmFi@next
314 }
315 \EmFi@DefineKey{initialfile}{}
316 \def\embedfilesetup{%
317   \ifEmFi@finished
318     \def\EmFi@next##1{}%
319     \EmFi@Error{%
320       \string\embedfilefield\ltx@space after \string\embedfilefinish
321     }{%
322       The list of embedded files is already written.%
323     }%
324   \else
325     \def\EmFi@next{%
326       \kvsetkeys{EmFi}%
327     }%
328   \fi
329   \EmFi@next
330 }
331 \def\EmFi@schema{}
332 \gdef\EmFi@order{0}
333 \let\EmFi@@order\relax
334 \def\EmFi@fieldlist{}
335 \def\EmFi@sortcase{0}%
336 \def\embedfilefield#1#2{%
337   \ifEmFi@finished
338     \EmFi@Error{%
339       \string\embedfilefield\ltx@space after \string\embedfilefinish
340     }{%
341       The list of embedded files is already written.%
342     }%
343   \else
344     \global\EmFi@collectiontrue
345     \EdefSanitize\EmFi@key{#1}%
346     \expandafter\ifx\csname KV@EmFi@\EmFi@key.prefix\endcsname\relax
347       \begingroup
348         \count@=\EmFi@order
349         \advance\count@ 1 %
350         \xdef\EmFi@order{\the\count@}%
351         \let\EmFi@title\EmFi@key
352         \let\EmFi@type\EmFi@S@text
353         \EmFi@visibletrue
354         \EmFi@editfalse
355         \kvsetkeys{EmFiFi}{#2}%
356         \EmFi@convert\EmFi@title\EmFi@title
357         \xdef\EmFi@schema{%
358           \EmFi@schema
359           /\pdf@escapename{\EmFi@key}<<%
360             /Subtype/%
361             \ifx\EmFi@type\EmFi@S@date D%
362             \else\ifx\EmFi@type\EmFi@S@number N%
363             \else\ifx\EmFi@type\EmFi@S@file F%
364             \else\ifx\EmFi@type\EmFi@S@desc Desc%
365             \else\ifx\EmFi@type\EmFi@S@afrelationship AFRelationship%
366             \else\ifx\EmFi@type\EmFi@S@moddate ModDate%
367             \else\ifx\EmFi@type\EmFi@S@creationdate CreationDate%
368             \else\ifx\EmFi@type\EmFi@S@size Size%
369             \else S%
370             \fi\fi\fi\fi\fi\fi\fi
371             /N(\EmFi@title)%
372             \EmFi@@order{\EmFi@order}%
373             \ifEmFi@visible
374             \else
375               /V false%
376             \fi
377             \ifEmFi@edit
378               /E true%
379             \fi
380           >>%
381         }%
382         \let\do\relax
383         \xdef\EmFi@fieldlist{%
384           \EmFi@fieldlist
385           \do{\EmFi@key}%
386         }%
387         \ifx\EmFi@type\EmFi@S@text
388           \kv@define@key{EmFi}{\EmFi@key.value}{%
389             \EmFi@itemtrue
390             \def\EmFi@temp{##1}%
391             \EmFi@convert\EmFi@temp\EmFi@temp
392             \expandafter\def\csname EmFi@V@#1%
393             \expandafter\endcsname\expandafter{%
394               \expandafter(\EmFi@temp)%
395             }%
396           }%
397           \EmFi@GlobalKey{EmFi}{\EmFi@key.value}%
398         \else\ifx\EmFi@type\EmFi@S@date
399           \kv@define@key{EmFi}{\EmFi@key.value}{%
400             \EmFi@itemtrue
401             \def\EmFi@temp{##1}%
402             \EmFi@convert\EmFi@temp\EmFi@temp
403             \expandafter\def\csname EmFi@V@#1%
404             \expandafter\endcsname\expandafter{%
405               \expandafter(\EmFi@temp)%
406             }%
407           }%
408           \EmFi@GlobalKey{EmFi}{\EmFi@key.value}%
409         \else\ifx\EmFi@type\EmFi@S@number
410           \kv@define@key{EmFi}{\EmFi@key.value}{%
411             \EmFi@itemtrue
412             \expandafter\EdefSanitize\csname EmFi@V@#1\endcsname{ ##1}%
413           }%
414           \EmFi@GlobalKey{EmFi}{\EmFi@key.value}%
415         \fi\fi\fi
416         \kv@define@key{EmFi}{\EmFi@key.prefix}{%
417           \EmFi@itemtrue
418           \expandafter\def\csname EmFi@P@#1\endcsname{##1}%
419         }%
420         \EmFi@GlobalKey{EmFi}{\EmFi@key.prefix}%
421         \kv@define@key{EmFiSo}{\EmFi@key}[ascending]{%
422           \EdefSanitize\EmFi@temp{##1}%
423           \ifx\EmFi@temp\EmFi@S@ascending
424             \def\EmFi@temp{true}%
425           \else\ifx\EmFi@temp\EmFi@S@descending
426             \def\EmFi@temp{false}%
427           \else
428             \def\EmFi@temp{}%
429             \EmFi@Error{%
430               Unknown sort order `\EmFi@temp'.\MessageBreak
431               Supported values: `\EmFi@S@ascending', %
432               `\EmFi@S@descending
433             }\@ehc
434           \fi\fi
435           \ifx\EmFi@temp\ltx@empty
436           \else
437             \xdef\EmFi@sortkeys{%
438               \EmFi@sortkeys
439               /\pdf@escapename{#1}%
440             }%
441             \ifx\EmFi@sortorders\ltx@empty
442               \global\let\EmFi@sortorders\EmFi@temp
443               \gdef\EmFi@sortcase{1}%
444             \else
445               \xdef\EmFi@sortorders{%
446                 \EmFi@sortorders
447                 \ltx@space
448                 \EmFi@temp
449               }%
450               \xdef\EmFi@sortcase{2}%
451             \fi
452           \fi
453         }%
454         \EmFi@GlobalDefaultKey{EmFiSo}\EmFi@key
455       \endgroup
456     \else
457       \EmFi@Error{%
458         Field `\EmFi@key' is already defined%
459       }\@ehc
460     \fi
461   \fi
462 }
463 \kv@define@key{EmFiFi}{type}{%
464   \EdefSanitize\EmFi@temp{#1}%
465   \ifx\EmFi@temp\EmFi@S@text
466     \let\EmFi@type\EmFi@temp
467   \else\ifx\EmFi@temp\EmFi@S@date
468     \let\EmFi@type\EmFi@temp
469   \else\ifx\EmFi@temp\EmFi@S@number
470     \let\EmFi@type\EmFi@temp
471   \else\ifx\EmFi@temp\EmFi@S@file
472     \let\EmFi@type\EmFi@temp
473   \else\ifx\EmFi@temp\EmFi@S@desc
474     \let\EmFi@type\EmFi@temp
475   \else\ifx\EmFi@temp\EmFi@S@afrelationship
476     \let\EmFi@type\EmFi@temp
477   \else\ifx\EmFi@temp\EmFi@S@moddate
478     \let\EmFi@type\EmFi@temp
479   \else\ifx\EmFi@temp\EmFi@S@creationdate
480     \let\EmFi@type\EmFi@temp
481   \else\ifx\EmFi@temp\EmFi@S@size
482     \let\EmFi@type\EmFi@temp
483   \else
484     \EmFi@Error{%
485       Unknown type `\EmFi@temp'.\MessageBreak
486       Supported types: `text', `date', `number', `file',\MessageBreak
487       `desc', `afrelationship', `moddate', `creationdate', `size'%
488     }%
489   \fi\fi\fi\fi\fi\fi\fi\fi\fi
490 }
491 \kv@define@key{EmFiFi}{title}{%
492   \def\EmFi@title{#1}%
493 }
494 \def\EmFi@setboolean#1#2{%
495   \EdefSanitize\EmFi@temp{#2}%
496   \ifx\EmFi@temp\EmFi@S@true
497     \csname EmFi@#1true\endcsname
498   \else
499     \ifx\EmFi@temp\EmFi@S@false
500       \csname EmFi@#1false\endcsname
501     \else
502       \EmFi@Error{%
503         Unknown value `\EmFi@temp' for key `#1'.\MessageBreak
504         Supported values: `true', `false'%
505       }\@ehc
506     \fi
507   \fi
508 }
509 \kv@define@key{EmFiFi}{visible}[true]{%
510   \EmFi@setboolean{visible}{#1}%
511 }
512 \kv@define@key{EmFiFi}{edit}[true]{%
513   \EmFi@setboolean{edit}{#1}%
514 }
515 \def\EmFi@sortkeys{}
516 \def\EmFi@sortorders{}
517 \def\embedfilesort{%
518   \kvsetkeys{EmFiSo}%
519 }
520 \def\embedfile{%
521   \ltx@ifnextchar[\EmFi@embedfile{\EmFi@embedfile[]}%
522 }
523 \def\EmFi@embedfile[#1]#2{%
524   \ifEmFi@finished
525     \EmFi@Error{%
526       \string\embedfile\ltx@space after \string\embedfilefinish
527     }{%
528       The list of embedded files is already written.%
529     }%
530   \else
531     \begingroup
532       \def\EmFi@file{#2}%
533       \kvsetkeys{EmFi}{#1}%
534       \expandafter\expandafter\expandafter
535       \ifx\expandafter\expandafter\expandafter
536           \\\pdf@filesize{\EmFi@file}\\%
537         \EmFi@Error{%
538           File `\EmFi@file' not found%
539         }{%
540           The unknown file is not embedded.%
541         }%
542       \else
543         \edef\EmFi@@filespec{%
544           \pdf@escapestring{\EmFi@filespec}%
545         }%
546         \ifx\EmFi@ucfilespec\ltx@empty
547           \let\EmFi@@ucfilespec\ltx@empty
548         \else
549           \EmFi@convert\EmFi@ucfilespec\EmFi@@ucfilespec
550         \fi
551         \ifx\EmFi@desc\ltx@empty
552           \let\EmFi@@desc\ltx@empty
553         \else
554           \EmFi@convert\EmFi@desc\EmFi@@desc
555         \fi
556         \ifx\EmFi@afrelationship\ltx@empty
557           \let\EmFi@@afrelationship\ltx@empty
558         \else
559           \EmFi@convert\EmFi@afrelationship\EmFi@@afrelationship
560         \fi
561         \ifEmFi@item
562           \let\do\EmFi@do
563           \immediate\pdfobj{%
564             <<%
565               \EmFi@fieldlist
566             >>%
567           }%
568           \edef\EmFi@ci{\the\pdflastobj}%
569         \fi
570         \immediate\pdfobj stream attr{%
571           /Type/EmbeddedFile%
572           \ifx\EmFi@mimetype\ltx@empty
573           \else
574             /Subtype/\pdf@escapename{\EmFi@mimetype}%
575           \fi
576           /Params<<%
577             /ModDate(\pdf@filemoddate{\EmFi@file})%
578             /Size \pdf@filesize{\EmFi@file}%
579             /CheckSum<\pdf@filemdfivesum{\EmFi@file}>%
580           >>%
581         }file{\EmFi@file}\relax
582         \EmFi@defobj{EmbeddedFile}%
583         \immediate\pdfobj{%
584           <<%
585             /Type/Filespec%
586             \ifx\EmFi@filesystem\ltx@empty
587             \else
588             /FS/\pdf@escapename{\EmFi@filesystem}%
589             \fi
590             /F(\EmFi@@filespec)%
591             \ifx\EmFi@@ucfilespec\ltx@empty
592             \else
593               /UF(\EmFi@@ucfilespec)%
594             \fi
595             \ifx\EmFi@@desc\ltx@empty
596             \else
597               /Desc(\EmFi@@desc)%
598             \fi
599             \ifx\EmFi@@afrelationship\ltx@empty
600             \else
601               /AFRelationship\EmFi@@afrelationship%
602             \fi
603             /EF<<%
604               /F \the\pdflastobj\ltx@space 0 R%
605             >>%
606             \ifEmFi@item
607               /CI \EmFi@ci\ltx@space 0 R%
608             \fi
609           >>%
610         }%
611         \EmFi@defobj{Filespec}%
612         \EmFi@add{%
613           \EmFi@@filespec
614         }{\the\pdflastobj\ltx@space 0 R}%
615       \fi
616     \endgroup
617   \fi
618 }
619 \def\EmFi@do#1{%
620   \expandafter\ifx\csname EmFi@P@#1\endcsname\relax
621     \expandafter\ifx\csname EmFi@V@#1\endcsname\relax
622     \else
623       /\pdf@escapename{#1}\csname EmFi@V@#1\endcsname
624     \fi
625   \else
626     /\pdf@escapename{#1}<<%
627       \expandafter\ifx\csname EmFi@V@#1\endcsname\relax
628       \else
629         /D\csname EmFi@V@#1\endcsname
630       \fi
631       /P(\csname EmFi@P@#1\endcsname)%
632     >>%
633   \fi
634 }
635 \def\EmFi@convert#1#2{%
636   \ifnum\pdf@strcmp{\EmFi@stringmethod}{psd}=0 %
637     \pdfstringdef\EmFi@temp{#1}%
638     \let#2\EmFi@temp
639   \else
640     \edef#2{\pdf@escapestring{#1}}%
641   \fi
642 }
643 \global\let\EmFi@list\ltx@empty
644 \def\EmFi@add#1#2{%
645   \begingroup
646     \ifx\EmFi@list\ltx@empty
647       \xdef\EmFi@list{\noexpand\do{#1}{#2}}%
648     \else
649       \def\do##1##2{%
650         \ifnum\pdf@strcmp{##1}{#1}>0 %
651           \edef\x{%
652             \toks@{%
653               \the\toks@%
654               \noexpand\do{#1}{#2}%
655               \noexpand\do{##1}{##2}%
656             }%
657           }%
658           \x
659           \def\do####1####2{%
660             \toks@\expandafter{\the\toks@\do{####1}{####2}}%
661           }%
662           \def\stop{%
663             \xdef\EmFi@list{\the\toks@}%
664           }%
665         \else
666           \toks@\expandafter{\the\toks@\do{##1}{##2}}%
667         \fi
668       }%
669       \def\stop{%
670         \xdef\EmFi@list{\the\toks@\noexpand\do{#1}{#2}}%
671       }%
672       \toks@{}%
673       \EmFi@list\stop
674     \fi
675   \endgroup
676 }
677 \def\embedfilefinish{%
678   \ifEmFi@finished
679     \EmFi@Error{%
680       Too many invocations of \string\embedfilefinish
681     }{%
682       The list of embedded files is already written.%
683     }%
684   \else
685     \ifx\EmFi@list\ltx@empty
686     \else
687       \global\EmFi@finishedtrue
688       \begingroup
689         \def\do##1##2{%
690           (##1)##2%
691         }%
692         \immediate\pdfobj{%
693           <<%
694             /Names[\EmFi@list]%
695           >>%
696         }%
697         \pdfnames{%
698           /EmbeddedFiles \the\pdflastobj\ltx@space 0 R%
699         }%
700       \endgroup
701       \begingroup
702         \def\do##1##2{%
703           \ltx@space##2%
704         }%
705         \immediate\pdfobj{%
706           [\EmFi@list]%
707         }%
708         \pdfcatalog{%
709           /AF \the\pdflastobj\ltx@space 0 R%
710         }%
711       \endgroup
712       \ifx\EmFi@initialfile\ltx@empty
713       \else
714         \EmFi@collectiontrue
715       \fi
716       \ifEmFi@collection
717         \ifx\EmFi@initialfile\ltx@empty
718           \let\EmFi@@initialfile\ltx@empty
719         \else
720           \edef\EmFi@@initialfile{%
721             \pdf@escapestring{\EmFi@initialfile}%
722           }%
723         \fi
724         \begingroup
725           \let\f=N%
726           \def\do##1##2{%
727             \def\x{##1}%
728             \ifx\x\EmFi@@initialfile
729               \let\f=Y%
730               \let\do\ltx@gobbletwo
731             \fi
732           }%
733           \EmFi@list
734         \expandafter\endgroup
735         \ifx\f Y%
736         \else
737           \@PackageWarningNoLine{embedfile}{%
738             Missing initial file `\EmFi@initialfile'\MessageBreak
739             among the embedded files%
740           }%
741           \let\EmFi@initialfile\ltx@empty
742           \let\EmFi@@initialfile\ltx@empty
743         \fi
744         \ifcase\EmFi@sortcase
745           \def\EmFi@temp{}%
746         \or
747           \def\EmFi@temp{%
748             /S\EmFi@sortkeys
749             /A \EmFi@sortorders
750           }%
751         \else
752           \def\EmFi@temp{%
753             /S[\EmFi@sortkeys]%
754             /A[\EmFi@sortorders]%
755           }%
756         \fi
757         \def\EmFi@@order##1{%
758           \ifnum\EmFi@order>1 %
759             /O ##1%
760           \fi
761         }%
762         \immediate\pdfobj{%
763           <<%
764             \ifx\EmFi@schema\ltx@empty
765             \else
766               /Schema<<\EmFi@schema>>%
767             \fi
768             \ifx\EmFi@@initialfile\ltx@empty
769             \else
770               /D(\EmFi@@initialfile)%
771             \fi
772             \ifx\EmFi@view\EmFi@S@tile
773               /View/T%
774             \else\ifx\EmFi@view\EmFi@S@hidden
775               /View/H%
776             \fi\fi
777             \ifx\EmFi@temp\ltx@empty
778               \EmFi@temp
779             \else
780               /Sort<<\EmFi@temp>>%
781             \fi
782           >>%
783         }%
784         \pdfcatalog{%
785           /Collection \the\pdflastobj\ltx@space0 R%
786         }%
787       \fi
788     \fi
789   \fi
790 }
791 \begingroup\expandafter\expandafter\expandafter\endgroup
792 \expandafter\ifx\csname AtEndDocument\endcsname\relax
793 \else
794   \AtEndDocument{\embedfilefinish}%
795 \fi
796 \EmFi@AtEnd%
797 \endinput
798 %%
799 %% End of file `embedfile.sty'.