Debian Codegraph @

texmf-dist/source/latex/attachfile2/attachfile2.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: attachfile2.dtx
4 % Version: 2024-01-18 v2.12
5 % Info: Attach files into PDF
6 %
7 % Copyright (C)
8 % 2005-2010, 2012 Heiko Oberdiek
9 % 2016-2019 Oberdiek Package Support Group
10 % https://github.com/ho-tex/attachfile2/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/attachfile2/issues
27 %
28 % This work consists of the main source file attachfile2.dtx
29 % and the derived files
30 % attachfile2.sty, attachfile2.pdf,
31 % atfi-dvips.def, atfi-pdftex.def, atfi-dvipdfmx.def, atfi-luatex.def
32 % pdfatfi.pl pdfatfi.1.
33 %
34 % Distribution:
35 % CTAN:macros/latex/contrib/attachfile2/attachfile2.dtx
36 % CTAN:macros/latex/contrib/attachfile2/attachfile2.pdf
37 %
38 % Unpacking:
39 % (a) If attachfile2.ins is present:
40 % tex attachfile2.ins
41 % (b) Without attachfile2.ins:
42 % tex attachfile2.dtx
43 % (c) If you insist on using LaTeX
44 % latex \let\install=y\input{attachfile2.dtx}
45 % (quote the arguments according to the demands of your shell)
46 %
47 % Documentation:
48 % (a) If attachfile2.drv is present:
49 % latex attachfile2.drv
50 % (b) Without attachfile2.drv:
51 % latex attachfile2.dtx; ...
52 % The class ltxdoc loads the configuration file ltxdoc.cfg
53 % if available. Here you can specify further options, e.g.
54 % use A4 as paper format:
55 % \PassOptionsToClass{a4paper}{article}
56 %
57 % Programm calls to get the documentation (example):
58 % pdflatex attachfile2.dtx
59 % makeindex -s gind.ist attachfile2.idx
60 % pdflatex attachfile2.dtx
61 % makeindex -s gind.ist attachfile2.idx
62 % pdflatex attachfile2.dtx
63 %
64 % Installation:
65 % TDS:tex/latex/attachfile2/attachfile2.sty
66 % TDS:tex/latex/attachfile2/atfi-dvips.def
67 % TDS:tex/latex/attachfile2/atfi-pdftex.def
68 % TDS:tex/latex/attachfile2/atfi-dvipdfmx.def
69 % TDS:tex/latex/attachfile2/atfi-luatex.def
70 % TDS:scripts/attachfile2/pdfatfi.pl (exec flag)
71 % TDS:doc/latex/attachfile2/attachfile2.pdf
72 % TDS:doc/man/man1/pdfatfi.1
73 % TDS:source/latex/attachfile2/attachfile2.dtx
74 %
75 %<*ignore>
76 \begingroup
77 \catcode123=1 %
78 \catcode125=2 %
79 \def\x{LaTeX2e}%
80 \expandafter\endgroup
81 \ifcase 0\ifx\install y1\fi\expandafter
82 \ifx\csname processbatchFile\endcsname\relax\else1\fi
83 \ifx\fmtname\x\else 1\fi\relax
84 \else\csname fi\endcsname
85 %</ignore>
86 %<*install>
87 \input docstrip.tex
88 \Msg{************************************************************************}
89 \Msg{* Installation}
90 \Msg{* Package: attachfile2 2024-01-18 v2.12 Attach files into PDF (HO)}
91 \Msg{************************************************************************}
92
93 \keepsilent
94 \askforoverwritefalse
95
96 \let\MetaPrefix\relax
97 \preamble
98
99 This is a generated file.
100
101 Project: attachfile2
102 Version: 2024-01-18 v2.12
103
104 Copyright (C)
105 2005-2010, 2012 Heiko Oberdiek
106 2016-2019 Oberdiek Package Support Group
107
108 This work may be distributed and/or modified under the
109 conditions of the LaTeX Project Public License, either
110 version 1.3c of this license or (at your option) any later
111 version. This version of this license is in
112 https://www.latex-project.org/lppl/lppl-1-3c.txt
113 and the latest version of this license is in
114 https://www.latex-project.org/lppl.txt
115 and version 1.3 or later is part of all distributions of
116 LaTeX version 2005/12/01 or later.
117
118 This work has the LPPL maintenance status "maintained".
119
120 The Current Maintainers of this work are
121 Heiko Oberdiek and the Oberdiek Package Support Group
122 https://github.com/ho-tex/attachfile2/issues
123
124
125 This work consists of the main source file attachfile2.dtx
126 and the derived files
127 attachfile2.sty, attachfile2.pdf,
128 atfi-dvips.def, atfi-pdftex.def, atfi-dvipdfmx.def, atfi-luatex.def
129 pdfatfi.pl, pdfatfi.1.
130
131 \endpreamble
132 \let\MetaPrefix\DoubleperCent
133
134 \generate{%
135 \file{attachfile2.ins}{\from{attachfile2.dtx}{install}}%
136 \file{attachfile2.drv}{\from{attachfile2.dtx}{driver}}%
137 \usedir{tex/latex/attachfile2}%
138 \file{attachfile2.sty}{\from{attachfile2.dtx}{package}}%
139 \file{atfi-dvips.def}{\from{attachfile2.dtx}{dvips}}%
140 \file{atfi-pdftex.def}{\from{attachfile2.dtx}{pdftex}}%
141 \file{atfi-luatex.def}{\from{attachfile2.dtx}{luatex}}%
142 \file{atfi-dvipdfmx.def}{\from{attachfile2.dtx}{dvipdfmx}}%
143 \nopreamble
144 \nopostamble
145 \usedir{doc/man/man1/}%
146 \file{pdfatfi.1}{\from{attachfile2.dtx}{pdfatfiman}}%
147 \usedir{scripts/attachfile2}%
148 \csname execfiletrue\endcsname
149 \file{pdfatfi.pl}{\from{attachfile2.dtx}{pdfatfi}}%
150 % \usedir{source/latex/attachfile2/catalogue}%
151 % \file{attachfile2.xml}{\from{attachfile2.dtx}{catalogue}}%
152 }
153
154 \catcode32=13\relax% active space
155 \let =\space%
156 \Msg{************************************************************************}
157 \Msg{*}
158 \Msg{* To finish the installation you have to move the following}
159 \Msg{* files into a directory searched by TeX:}
160 \Msg{*}
161 \Msg{* attachfile2.sty, atfi-dvips.def, atfi-pdftex.def,}
162 \Msg{* atfi-dvipdfmx.def, atfi-luatex.def}
163 \Msg{*}
164 \Msg{* And install the following script file:}
165 \Msg{*}
166 \Msg{* pdfatfi.pl}
167 \Msg{*}
168 \Msg{* To produce the documentation run the file `attachfile2.drv'}
169 \Msg{* through LaTeX.}
170 \Msg{*}
171 \Msg{* Happy TeXing!}
172 \Msg{*}
173 \Msg{************************************************************************}
174
175 \endbatchfile
176 %</install>
177 %<*ignore>
178 \fi
179 %</ignore>
180 %<*driver>
181 \NeedsTeXFormat{LaTeX2e}
182 \ProvidesFile{attachfile2.drv}%
183 [2024-01-18 v2.12 Attach files into PDF (HO)]%
184 \documentclass{ltxdoc}
185 \usepackage{holtxdoc}[2011/11/22]
186 \begin{document}
187 \DocInput{attachfile2.dtx}%
188 \end{document}
189 %</driver>
190 % \fi
191 %
192 %
193 %
194 % \GetFileInfo{attachfile2.drv}
195 %
196 % \title{The \xpackage{attachfile2} package}
197 % \date{2024-01-18 v2.12}
198 % \author{Heiko Oberdiek\thanks
199 % {Please report any issues at \url{https://github.com/ho-tex/attachfile2/issues}}}
200 %
201 % \maketitle
202 %
203 % \begin{abstract}
204 % This package can be used to attach files to a PDF document.
205 % It is a further development of Scott Pakin's package
206 % \xpackage{attachfile} for \pdfTeX. Apart from bug fixes,
207 % package \xpackage{attachfile2} adds support for \xoption{dvips},
208 % some new options, gets and writes meta information data about
209 % the attached files.
210 % \end{abstract}
211 %
212 % \tableofcontents
213 %
214 % \section{Documentation}
215 %
216 % \subsection{Introduction}
217 %
218 % The PDF format (\cite{pdfspec}) allows the inclusion of files
219 % inside the PDF document. The included files can be bound to an
220 % annotation on a page. Or they can be recorded in a sorted
221 % list of embedded files. The packages \xpackage{attachfile}
222 % or \xpackage{attachfile2} follow the first approach,
223 % package \xpackage{embedfile} uses the latter method.
224 %
225 % \subsubsection{Future development}
226 %
227 % My dream is a large package that merges the features of
228 % all these packages meantioned before:
229 % \begin{itemize}
230 % \item Files can be attached to a page.
231 % \item Files can be attached to the document.
232 % \item An easy user interface for simple, common tasks and
233 % beginners.
234 % \item An interface for the advanced users that want to setup
235 % every detail.
236 % \item Support of many drivers (pdftex, dvips, dvipdfm, \dots).
237 % \item \dots
238 % \end{itemize}
239 % However, I have not managed to take the time for this project.
240 % Instead:
241 % \begin{itemize}
242 % \item First I experimented with package \xpackage{attachfile},
243 % adding driver support, fixing bugs, \dots. The result is
244 % currently named as \xpackage{attachfile2}. It uses an external
245 % script to get file properties (size, date, checksum, \dots).
246 % \item In order to avoid an external program for getting basic
247 % file properties I provided a patch ``EscapeAndOther'' for
248 % pdfTeX that was accepted for version 1.30.
249 % \item Package \xpackage{embedfile} closes a gap left by the
250 % packages for attaching
251 % files and allows the embedding of files to the document.
252 % Also it makes use of the new primitives of \pdfTeX.
253 % \end{itemize}
254 % Until this future becomes true, I provide the intermediate
255 % step \xpackage{attachfile2} at its current state.
256 % There are many things to do:
257 % \begin{itemize}
258 % \item Documentation, documentation, \dots
259 % \item Improving portability of the Perl script \xfile{pdfatfi.pl}
260 % (Windows, non-GNU, \dots).
261 % \item Comfortable program for extracting embeddd files.
262 % \item Embedding files to the document, see package \xpackage{embedfile}.
263 % \item Additionally use featurs of \pdfTeX\ 1.30. With a recent
264 % \pdfTeX\ the Perl script step is then obsolete.
265 % \item GoToE links.
266 % \item Layout of PinPush, especially the tip does not scale well.
267 % \item Driver for \xoption{dvipsone}, similar to \xoption{dvips}, changes:
268 % \begin{itemize}
269 % \item coordinate transformation need to be fixed here,
270 % \xfile{hdvipson.def} contains:
271 % \begin{quote}
272 %\begin{verbatim}
273 %/DvipsToPDF { 65781 div } def
274 %/PDFToDvips { 65781 mul } def
275 %\end{verbatim}
276 % \end{quote}
277 % \item Syntax for \cs{special}: \xfile{hdvipson.def} contains
278 % both \verb|\special{! #1}| and
279 % \verb|\special{headertext= #1}|. Are bothe the same?
280 % \end{itemize}
281 % \item File name conversion, see PDF specification:
282 % \begin{quote}
283 % \verb|c:\somewhere\foobar.txt| $\rightarrow$
284 % \verb|/c/somewhere/foobar.txt|
285 % \end{quote}
286 % \item Option \xoption{scale} for icons?
287 % \item Compatibility for \plainTeX.
288 % \item ToDos for \xfile{atfidvips.def}.
289 % \end{itemize}
290 %
291 % \subsection{User interface}
292 %
293 % Basically this package \xpackage{attachfile2} follows the
294 % user interface of package \xpackage{attachfile},
295 % look into its documentation (\cite{attachfile}).
296 %
297 % \subsubsection{New options}
298 % \begin{itemize}
299 % \item Driver options \xoption{dvips}, \xoption{pdftex},
300 % \xoption{dvipdfmx} and \xoption{xetex} that is an
301 % alias for \xoption{dvipdfmx}.
302 % \item Option \xoption{driverfallback} specifies a DVI driver
303 % if the driver cannot be detected automatically.
304 % \item New options \xoption{final} and \xoption{draft}.
305 % \item New option \xoption{scale} for scaling the annotation rectangle.
306 % \item Option \xoption{nofiles} for controlling
307 % the generation of the auxiliary file \xfile{.atfi}.
308 % \item New option \xoption{ucfilespec} for file names with
309 % characters outside ASCII (PDF 1.7).
310 % \item New option \xoption{locked} to set the \texttt{Locked} flag.
311 % \end{itemize}
312 %
313 % \subsubsection{Option \xoption{color}}
314 %
315 % Package \xpackage{attachfile}'s option \xoption{color} only
316 % understands explicit RGB values as three space separated
317 % real numbers in the range from 0 to 1.
318 %
319 % This package \xpackage{attachfile2} extends the syntax.
320 % The usual color specifications of packages \xpackage{color}
321 % or \xpackage{xcolor} may be used. The latter one requires
322 % that package \xpackage{xcolor} is loaded.
323 % Without package \xpackage{xcolor} a limited range of
324 % explicit color specifications are supported, the color models
325 % \texttt{rgb} and \texttt{gray} (and \texttt{cmyk} if
326 % package \xpackage{hyperref}'s option \xoption{pdfversion} is set
327 % to \texttt{1.7} or greater.
328 %
329 % Example without package \xpackage{xcolor}:
330 %\begin{quote}
331 %\begin{verbatim}
332 %\documentclass{article}
333 %\usepackage[color={1 0 .5}]{attachfile2}
334 % % Spaces in option values in \usepackage or \documentclass
335 % % must be protected by curly braces. Otherwise LaTeX strips
336 % % the spaces and the package would see `color=10.5'.
337 % % This protection is not necessary for \attachfilesetup.
338 %\attachfilesetup{color=1 0 .5}
339 %\attachfilesetup{color=[rgb]{1,0,.5}}
340 %\attachfilesetup{color=[gray]{.5}}
341 %\end{verbatim}
342 %\end{quote}
343 %
344 % The following example with package \xpackage{xcolor} shows
345 % additional color specifications:
346 %\begin{quote}
347 %\begin{verbatim}
348 %\documentclass{article}
349 %\usepackage{xcolor}
350 %\definecolor{attachfilecolor}{cmyk}{.1,.2,.3,.4}
351 %\usepackage{color=red}{attachfile2}
352 %\attachfilesetup{color=red}
353 %\attachfilesetup{color=attachfilecolor}
354 %\end{verbatim}
355 %\end{quote}
356 %
357 % \paragraph{For experts.}%
358 % If the color is used in annotations, the color is converted
359 % with the help of package \xpackage{xcolor} to RGB.
360 % PDF versions 1.7 or later also understand color models Gray and
361 % CMYK. The PDF version is detected if the experimental
362 % option \xoption{pdfversion}
363 % of package \xpackage{hyperref} is used, example:
364 %\begin{quote}
365 %\begin{verbatim}
366 %\documentclass{article}
367 %\usepackage[pdfversion=1.7]{hyperref}
368 %\usepackage{attachfile2}
369 %\end{verbatim}
370 %\end{quote}
371 % However, currently only driver \xoption{pdftex} also supports
372 % the actual setting of the PDF version in the output PDF file.
373 %
374 % \subsubsection{Perl script \xfile{pdfatfi.pl}}
375 %
376 % This package also tries to get and add meta information data,
377 % such as file size, file date, checksum, \dots.
378 % As package \xpackage{embedfile} shows the new features
379 % of \pdfTeX\ 1.30 are very useful for getting this kind of
380 % data. Since version 2.6 these data are used if available.
381 %
382 % For older versions of \pdfTeX\ and \XeTeX\ the Perl script
383 % \xfile{pdfatfi.pl} is provided to get this data.
384 % The use of the Perl script is not mandatory. This data can be shown
385 % by PDF viewers, but they are not a requirement of the PDF specification.
386 %
387 % Package \xpackage{attachfile2} and the Perl script communicate
388 % via an auxiliary file with file extension \xfile{.atfi}. The script
389 % is used between two \LaTeX\ runs and updates the auxiliary file,
390 % example for \xoption{dvips}:
391 % \begin{quote}
392 %\begin{verbatim}
393 %latex test
394 %pdfatfi test
395 %latex test
396 %dvips test
397 %ps2pdf test.ps test.pdf
398 %\end{verbatim}
399 % \end{quote}
400 %
401 % \subsection{Changes to \xpackage{attachfile}}
402 %
403 % Some of the changes I can remember:
404 % \begin{itemize}
405 % \item Support for dvips.
406 % \item Support for dvipdfmx/\XeTeX.
407 % \item Setting and filling the /Param entry for files
408 % (file date, file size, \dots).
409 % \item Perl script \xfile{pdfatfi.pl}.
410 % \item New options.
411 % \item Bug fixes.
412 % \item \dots
413 % \end{itemize}
414 %
415 % \StopEventually{
416 % }
417 %
418 % \section{Implementation}
419 %
420 % \subsection{Package}
421 %
422 % \begin{macrocode}
423 %<*package>
424 \NeedsTeXFormat{LaTeX2e}
425 \ProvidesPackage{attachfile2}%
426 [2024-01-18 v2.12 Attach files into PDF (HO)]%
427 % \end{macrocode}
428 %
429 % \subsubsection{Loading of packages}
430 %
431 % \begin{macrocode}
432 \RequirePackage{iftex}[2019/11/07]
433 \RequirePackage{keyval}
434 \RequirePackage{color}
435 \RequirePackage{infwarerr}[2010/04/08]
436 \RequirePackage{ltxcmds}[2010/04/26]
437 \RequirePackage{kvoptions}[2009/07/21]
438 \RequirePackage{pdftexcmds}[2010/04/01]
439 \RequirePackage{pdfescape}[2007/11/11]
440 % \end{macrocode}
441 % Package \xpackage{hyperref} is needed because of \cs{pdfstringdef}.
442 % \begin{macrocode}
443 \RequirePackage{hyperref}
444 \RequirePackage{hycolor}[2008/07/29]
445 % \end{macrocode}
446 %
447 % \subsubsection{Value checking}
448 %
449 % \begin{macro}{\atfi@Match}
450 % \begin{macrocode}
451 \ltx@IfUndefined{pdfmatch}{%
452 \def\atfi@Match#1#2#3#4#5{}%
453 }{%
454 \def\atfi@Match#1#2#3{%
455 \begingroup
456 \edef\^{\ltx@backslashchar\string^}%
457 \edef\.{\ltx@backslashchar.}%
458 \let\#\ltx@hashchar
459 \edef\[{\ltx@backslashchar[}% ]]
460 \edef\${\ltx@backslashchar$}%
461 \let\%\ltx@percentchar
462 \edef\&{\string&}%
463 \edef\({\ltx@backslashchar(}%
464 \edef\){\ltx@backslashchar)}%
465 \edef\|{\ltx@backslashchar|}%
466 \edef\*{\ltx@backslashchar*}%
467 \edef\+{\ltx@backslashchar+}%
468 \edef\?{\ltx@backslashchar?}%
469 \edef\{{\ltx@backslashchar\ltx@leftbracechar}%
470 \edef\}{\ltx@rightbracechar}%
471 \edef\\{\ltx@backslashchar\ltx@backslashchar}%
472 \edef\~{\string~}%
473 \ifcase\pdfmatch#3{#2}{#1} %
474 \endgroup
475 \expandafter\ltx@secondoftwo
476 \or
477 \endgroup
478 \expandafter\ltx@firstoftwo
479 \else
480 \atfi@Warning{%
481 Internal error: Wrong pattern!\MessageBreak
482 --> #2 <--\MessageBreak
483 Pattern check ignored%
484 }%
485 \endgroup
486 \expandafter\ltx@firstoftwo
487 \fi
488 }%
489 % \end{macrocode}
490 % \end{macro}
491 % \begin{macro}{\atfi@PatToken}
492 % \begin{macrocode}
493 \def\atfi@PatToken{%
494 [%
495 -% first character
496 !%
497 \#$\%\&'%
498 \*\+\.%
499 0-9%
500 A-Z%
501 \^_`%
502 a-z%
503 \{\}\|\~%
504 ]+%
505 }%
506 % \end{macrocode}
507 % \end{macro}
508 % \begin{macro}{\atfi@CR}
509 % \begin{macrocode}
510 \begingroup
511 \lccode64=13 % @
512 \lowercase{\endgroup
513 \def\atfi@CR{@}%
514 }%
515 % \end{macrocode}
516 % \end{macro}
517 % \begin{macro}{\atfi@PatQuotedString}
518 % \begin{macrocode}
519 \def\atfi@PatQuotedString{%
520 "%
521 ([^"\\\atfi@CR]|\\.)*%
522 "%
523 }%
524 % \end{macrocode}
525 % \end{macro}
526 % \begin{macrocode}
527 \ltx@ifpackagelater{ltxcmds}{2010/09/11}{}{%
528 % \end{macrocode}
529 % \begin{macro}{\atfi@ltx@leftbracechar}
530 % \begin{macrocode}
531 \begingroup
532 \lccode`0=`\{\relax
533 \lowercase{\endgroup
534 \def\ltx@leftbracechar{0}%
535 }%
536 % \end{macrocode}
537 % \end{macro}
538 % \begin{macro}{\ltx@rightbracechar}
539 % \begin{macrocode}
540 \begingroup
541 \lccode`0=`\}\relax
542 \lowercase{\endgroup
543 \def\ltx@rightbracechar{0}%
544 }%
545 % \end{macrocode}
546 % \end{macro}
547 % \begin{macrocode}
548 }%
549 }
550 % \end{macrocode}
551 %
552 % \begin{macro}{\atfi@Warning}
553 % \begin{macrocode}
554 \def\atfi@Warning{\PackageWarning{attachfile2}}
555 % \end{macrocode}
556 % \end{macro}
557 %
558 % \subsubsection{Option declarations}
559 %
560 % \begin{macrocode}
561 \SetupKeyvalOptions{%
562 family=AtFi,%
563 prefix=atfi@%
564 }
565 % \end{macrocode}
566 % \begin{macro}{\atfi@setup}
567 % \begin{macrocode}
568 \def\atfi@setup{\setkeys{AtFi}}
569 % \end{macrocode}
570 % \end{macro}
571 %
572 % Options \xoption{draft} and \xoption{final}.
573 % \begin{macrocode}
574 \DeclareBoolOption{draft}
575 \DeclareComplementaryOption{final}{draft}
576 % \end{macrocode}
577 %
578 % Option \xoption{mimetype}.
579 % \begin{macro}{\atfi@mimetype}
580 % \begin{macrocode}
581 \def\atfi@mimetype{}
582 % \end{macrocode}
583 % \end{macro}
584 % \begin{macrocode}
585 \define@key{AtFi}{mimetype}{%
586 \edef\atfi@mimetype{#1}%
587 \ifx\atfi@mimetype\ltx@empty
588 \else
589 \atfi@Match\atfi@mimetype{%
590 ^(application|audio|image|model|text|video|x-\atfi@PatToken)%
591 /%
592 ([a-z\-\+_\.0-9]+)%
593 (; ?\atfi@PatToken=(\atfi@PatToken|\atfi@PatQuotedString))*$%
594 }{icase}{}{%
595 \atfi@Warning{%
596 Invalid value `\atfi@mimetype'\MessageBreak
597 of option `mimetype'.\MessageBreak
598 Value is discarded%
599 }%
600 \let\atfi@mimetype\ltx@empty
601 }%
602 \fi
603 \ifx\atfi@mimetype\ltx@empty
604 \else
605 \EdefEscapeName\atfi@mimetype{\atfi@mimetype}%
606 \edef\atfi@mimetype{/Subtype/\atfi@mimetype}%
607 \fi
608 }
609 % \end{macrocode}
610 %
611 % Option \xoption{icon}
612 % \begin{macrocode}
613 \define@key{AtFi}{icon}{%
614 \def\atfi@icon{/Name/#1}%
615 \def\atfi@icon@icon{#1}%
616 }
617 \atfi@setup{icon=PushPin}
618 % \end{macrocode}
619 %
620 % Option \xoption{color}
621 % \begin{macrocode}
622 \define@key{AtFi}{color}{%
623 \HyColor@AttachfileColor{#1}%
624 \atfi@color@tex\atfi@color@inline\atfi@color@annot
625 {attachfile2}{color}%
626 }
627 \atfi@setup{color=1 0.9255 0.7765}
628 % \end{macrocode}
629 %
630 % time options timezone and date
631 % \begin{macro}{\atfi@pad@ii}
632 % \begin{macrocode}
633 \def\atfi@pad@ii#1{%
634 \ifnum#1>9 %
635 \number#1%
636 \else
637 0\number#1%
638 \fi%
639 }
640 % \end{macrocode}
641 % \end{macro}
642 % \begin{macro}{atfi@timezone}
643 % \begin{macrocode}
644 \let\atfi@timezone\ltx@empty
645 % \end{macrocode}
646 % \end{macro}
647 % \begin{macrocode}
648 \define@key{AtFi}{timezone}{\def\atfi@timezone{#1}}
649 % \end{macrocode}
650 % \begin{macro}{\atfi@time}
651 % \begin{macrocode}
652 \edef\atfi@time{\the\time}
653 % \end{macrocode}
654 % \end{macro}
655 % \begin{macro}{\atfi@hours}
656 % \begin{macrocode}
657 \def\atfi@hours{%
658 \numexpr\dimexpr0.01667\dimexpr\atfi@time sp\relax\relax\relax
659 }
660 % \end{macrocode}
661 % \end{macro}
662 % \begin{macro}{\atfi@minutes}
663 % \begin{macrocode}
664 \def\atfi@minutes{%
665 \numexpr\atfi@time-60*\atfi@hours\relax
666 }
667 % \end{macrocode}
668 % \end{macro}
669 % \begin{macro}{\atfi@seconds}
670 % \begin{macrocode}
671 \def\atfi@seconds{0}
672 % \end{macrocode}
673 % \end{macro}
674 % \begin{macro}{\atfi@date}
675 % \begin{macrocode}
676 \def\atfi@date{%
677 /M(D:\the\year
678 \atfi@pad@ii\month
679 \atfi@pad@ii\day
680 \atfi@pad@ii\atfi@hours
681 \atfi@pad@ii\atfi@minutes
682 \atfi@pad@ii\atfi@seconds
683 \atfi@timezone)%
684 }
685 % \end{macrocode}
686 % \end{macro}
687 % \begin{macrocode}
688 \define@key{AtFi}{date}{%
689 \EdefEscapeString\atfi@date{#1}%
690 \edef\atfi@date{/M(\atfi@date)}%
691 }
692 % \end{macrocode}
693 %
694 % Text options author, description, and subject
695 % \begin{macro}{\atfi@pdfstringdef}
696 % \begin{macrocode}
697 \DeclareRobustCommand{\atfi@pdfstringdef}[2]{%
698 \pdfstringdef\atfi@temp@string{#2}%
699 \edef#1{\atfi@temp@string}%
700 }
701 % \end{macrocode}
702 % \end{macro}
703 %
704 % \begin{macro}{\atfi@NoValue}
705 % \begin{macrocode}
706 \def\atfi@NoValue{\NoValue}
707 % \end{macrocode}
708 % \end{macro}
709 %
710 % \begin{macro}{\atfi@DefNoValueName}
711 % \begin{macrocode}
712 \def\atfi@DefNoValueName#1#2#3{%
713 \def#1{#3}%
714 \ifx#1\atfi@NoValue
715 \let#1\ltx@empty
716 \else
717 \atfi@pdfstringdef#1{#1}%
718 \edef#1{/#2(#1)}%
719 \fi
720 }
721 % \end{macrocode}
722 % \end{macro}
723 %
724 % Name for annotation to be used in GoToE actions
725 % \begin{macro}{\atfi@annotname}
726 % \begin{macrocode}
727 \let\atfi@annotname\ltx@empty
728 % \end{macrocode}
729 % \end{macro}
730 % \begin{macrocode}
731 \define@key{AtFi}{annotname}[\NoValue]{%
732 \atfi@DefNoValueName\atfi@annotname{NM}{#1}%
733 }
734 % \end{macrocode}
735 %
736 % Option \xoption{author}.
737 % \begin{macro}{\atfi@author}
738 % \begin{macrocode}
739 \def\atfi@author{}
740 % \end{macrocode}
741 % \end{macro}
742 % \begin{macrocode}
743 \define@key{AtFi}{author}[\NoValue]{%
744 \atfi@DefNoValueName\atfi@author{T}{#1}%
745 }
746 % \end{macrocode}
747 %
748 % Option \xoption{description}.
749 % \begin{macro}{\atfi@description}
750 % \begin{macrocode}
751 \def\atfi@description{}
752 % \end{macrocode}
753 % \end{macro}
754 % \begin{macrocode}
755 \define@key{AtFi}{description}[\NoValue]{%
756 \atfi@DefNoValueName\atfi@description{Contents}{#1}%
757 }
758 % \end{macrocode}
759 %
760 % Option \xoption{subject}.
761 % \begin{macro}{\atfi@subject}
762 % \begin{macrocode}
763 \def\atfi@subject{}
764 % \end{macrocode}
765 % \end{macro}
766 % \begin{macrocode}
767 \define@key{AtFi}{subject}[\NoValue]{%
768 \atfi@DefNoValueName\atfi@subject{Subj}{#1}%
769 }
770 % \end{macrocode}
771 %
772 % Option \xoption{print}.
773 % \begin{macrocode}
774 \DeclareBoolOption[true]{print}
775 % \end{macrocode}
776 %
777 % Option \xoption{zoom}.
778 % \begin{macrocode}
779 \DeclareBoolOption[true]{zoom}
780 % \end{macrocode}
781 %
782 % Option \xoption{locked}.
783 % \begin{macrocode}
784 \DeclareBoolOption[true]{locked}
785 % \end{macrocode}
786 %
787 % Option \xoption{appearance}.
788 % \begin{macrocode}
789 \DeclareBoolOption[true]{appearance}
790 % \end{macrocode}
791 %
792 % Option \xoption{scale}.
793 % \begin{macrocode}
794 \DeclareStringOption[1]{scale}
795 % \end{macrocode}
796 %
797 % Option \xoption{ucfilespec}.
798 % \begin{macro}{\atfi@ucfilespec}
799 % \begin{macrocode}
800 \def\atfi@ucfilespec{}
801 % \end{macrocode}
802 % \end{macro}
803 % \begin{macrocode}
804 \define@key{AtFi}{ucfilespec}[1]{%
805 \def\atfi@ucfilespec{#1}%
806 \ifx\atfi@ucfilespec\ltx@empty
807 \else
808 \atfi@pdfstringdef\atfi@ucfilespec{#1}%
809 \fi
810 }
811 % \end{macrocode}
812 %
813 % Option \xoption{nofiles}.
814 % \begin{macrocode}
815 \DeclareBoolOption{nofiles}
816 % \end{macrocode}
817 %
818 % Driver options.
819 % \begin{macrocode}
820 \let\atfi@driver\ltx@empty
821 \def\atfi@driver@pdftex{pdftex}
822 \def\atfi@driver@luatex{luatex}
823 \def\atfi@driver@dvips{dvips}
824 \def\atfi@driver@dvipdfmx{dvipdfmx}
825 % \end{macrocode}
826 % \begin{macrocode}
827 \DeclareVoidOption{pdftex}{%
828 \ifpdf
829 \let\atfi@driver\atfi@driver@pdftex
830 \else
831 \let\atfi@driver\ltx@empty
832 \PackageError{attachfile2}{%
833 Wrong driver option `pdftex',\MessageBreak
834 because pdfTeX in PDF mode is not detected%
835 }\@ehc
836 \fi
837 }
838 \DeclareVoidOption{luatex}{%
839 \let\atfi@driver\atfi@driver@luatex
840 }
841 \DeclareVoidOption{dvips}{%
842 \let\atfi@driver\atfi@driver@dvips
843 }
844 \DeclareVoidOption{dvipdfmx}{%
845 \let\atfi@driver\atfi@driver@dvipdfmx
846 }
847 \DeclareVoidOption{xetex}{%
848 \let\atfi@driver\atfi@driver@dvipdfmx
849 }
850 % \end{macrocode}
851 % \begin{macrocode}
852 \DeclareStringOption{driverfallback}
853 % \end{macrocode}
854 %
855 % \begin{macro}{\attachfilesetup}
856 % \begin{macrocode}
857 \DeclareRobustCommand{\attachfilesetup}[1]{\setkeys{AtFi}{#1}}
858 % \end{macrocode}
859 % \end{macro}
860 %
861 % \begin{macrocode}
862 \DeclareLocalOptions{%
863 annotname,%
864 appearance,%
865 author,%
866 color,%
867 date,%
868 description,%
869 icon,%
870 mimetype,%
871 nofiles,%
872 print,%
873 scale,%
874 subject,%
875 timezone,%
876 ucfilespec,%
877 zoom,%
878 locked,%
879 }
880 % \end{macrocode}
881 %
882 % \subsubsection{Option calling}
883 %
884 % Timezone setting, \dots
885 % \begin{macrocode}
886 \InputIfFileExists{attachfile.cfg}{}{}
887 % \end{macrocode}
888 % \begin{macrocode}
889 \ProcessKeyvalOptions*
890 % \end{macrocode}
891 %
892 % \begin{macro}{\atfi@DisableOption}
893 % \begin{macrocode}
894 \def\atfi@DisableOption{%
895 \DisableKeyvalOption[action=error,package=attachfile2]{AtFi}%
896 }
897 % \end{macrocode}
898 % \end{macro}
899 %
900 % \subsubsection{Evaluate driver options}
901 %
902 % \begin{macrocode}
903 \ifpdf
904 \ifluatex
905 \let\atfi@driver\atfi@driver@luatex
906 \else
907 \let\atfi@driver\atfi@driver@pdftex
908 \fi
909 \else
910 \ifxetex
911 \let\atfi@driver\atfi@driver@dvipdfmx
912 \else
913 \ifx\atfi@driver\ltx@empty
914 \ifx\atfi@driverfallback\ltx@empty
915 \else
916 \expandafter\let\expandafter\atfi@driver
917 \csname atfi@driver@\atfi@driverfallback\endcsname
918 \ifx\atfi@driver\atfi@driver@dvips
919 \else
920 \ifx\atfi@driver\atfi@driver@dvipdfmx
921 \else
922 \let\atfi@driver\ltx@empty
923 \PackageWarningNoLine{attachfile2}{%
924 Option `driverfallback' with unsupported\MessageBreak
925 DVI driver (\atfi@driverfallback)%
926 }%
927 \fi
928 \fi
929 \fi
930 \ifx\atfi@driver\ltx@empty
931 \PackageWarningNoLine{attachfile2}{%
932 Driver is not specified,\MessageBreak
933 enforce draft settings%
934 }%
935 \atfi@drafttrue
936 \fi
937 \fi
938 \fi
939 \fi
940 % \end{macrocode}
941 % \begin{macrocode}
942 \atfi@DisableOption{pdftex}
943 \atfi@DisableOption{dvips}
944 \atfi@DisableOption{dvipdfmx}
945 \atfi@DisableOption{xetex}
946 \atfi@DisableOption{driverfallback}
947 % \end{macrocode}
948 %
949 % \subsubsection{Evaluate options \xoption{draft}/\xoption{final}}
950 %
951 % \begin{macro}{\notextattachfile}
952 % \begin{macrocode}
953 \DeclareRobustCommand{\notextattachfile}[2][]{%
954 \begingroup
955 \atfi@setup{#1}%
956 \ifatfi@print
957 \leavevmode
958 \begingroup
959 \HyColor@UseColor\atfi@color@tex
960 #2\strut
961 \endgroup
962 \else
963 \sbox\ltx@zero{#2\strut}%
964 \makebox[\wd0]{}%
965 \fi
966 \endgroup
967 }
968 % \end{macrocode}
969 % \end{macro}
970 % \begin{macrocode}
971 \atfi@DisableOption{draft}%
972 \atfi@DisableOption{final}%
973 \ifatfi@draft
974 \def\atfi@dummy@pushpin{%
975 \raisebox{-1.25bp}{\parbox[b][14bp]{24bp}{}}%
976 }%
977 \DeclareRobustCommand{\textattachfile}[3][]{%
978 \notextattachfile[{#1}]{#3}%
979 }%
980 \DeclareRobustCommand{\noattachfile}[1][]{%
981 \notextattachfile[{#1}]{\atfi@dummy@pushpin}%
982 }%
983 \DeclareRobustCommand{\attachfile}[2][]{%
984 \noattachfile[{#1}]%
985 }%
986 \expandafter\endinput
987 \fi
988 % \end{macrocode}
989 %
990 % \subsubsection{Load driver file}
991 %
992 % \begin{macrocode}
993 \input{atfi-\[email protected]}
994 % \end{macrocode}
995 %
996 % \subsubsection{Graphics}
997 %
998 % \begin{macro}{\atfi@acroGraph@data}
999 % \begin{macrocode}
1000 \def\atfi@acroGraph@data{%
1001 \atfi@GSAVE
1002 0.5 \atfi@SETGRAYFILL
1003 1.1133 0 20.7202 18.2754 \atfi@RECTFILL
1004 0 \atfi@SETFLAT
1005 0.5 \atfi@SETLINEWIDTH
1006 4 \atfi@SETMITERLIMIT
1007 \atfi@RECTSTROKEFILL{%
1008 1 \atfi@SETGRAYFILL
1009 }{%
1010 0 \atfi@SETGRAYSTROKE
1011 }{%
1012 0.25 1.6453 20.145 17.7715 %
1013 }%
1014 0 \atfi@SETGRAYFILL
1015 2.7319 4.1367 3.9571 13.8867 \atfi@RECTFILL
1016 8.7031 4.1367 3.9571 9.8867 \atfi@RECTFILL
1017 14.7471 4.1367 3.9571 11.8867 \atfi@RECTFILL
1018 \atfi@color@inline{FILL}%
1019 1.689 3.0938 3.9571 13.8867 \atfi@RECTFILL
1020 7.6602 3.0938 3.9571 9.8867 \atfi@RECTFILL
1021 13.7041 3.0938 3.9571 11.8867 \atfi@RECTFILL
1022 \atfi@GRESTORE
1023 }
1024 % \end{macrocode}
1025 % \end{macro}
1026 % \begin{macro}{\atfi@acroGraph}
1027 % \begin{macrocode}
1028 \def\atfi@acroGraph{%
1029 \raisebox{-1.5bp}{\parbox[b][20bp]{22bp}{%
1030 \rule{0pt}{0pt}\atfi@literal{\atfi@acroGraph@data}}%
1031 }%
1032 }
1033 % \end{macrocode}
1034 % \end{macro}
1035 % \begin{macro}{\atfi@acroPaperclip@data}
1036 % \begin{macrocode}
1037 \newcommand{\atfi@acroPaperclip@data}{%
1038 \atfi@GSAVE
1039 0.75 \atfi@SETGRAYSTROKE
1040 0 \atfi@SETFLAT
1041 2.5 \atfi@SETLINEWIDTH
1042 1 \atfi@SETLINECAP
1043 4 \atfi@SETMITERLIMIT
1044 1.9619 11.7559 \atfi@MOVETO
1045 1.9619 3.3037 1.9619 2.5059 \atfi@CURVETOV
1046 1.9619 1.707 4.0947 1.25 \atfi@CURVETOY
1047 7.4141 1.25 \atfi@LINETO
1048 9.4292 1.8223 9.4292 3.3066 \atfi@CURVETOV
1049 9.4292 4.79 9.4292 16.8945 \atfi@CURVETOY
1050 9.7852 18.1514 8.481 18.1514 \atfi@CURVETOV
1051 7.1768 18.1514 5.1616 18.1514 \atfi@CURVETOY
1052 3.8574 17.9209 3.8574 16.8945 \atfi@CURVETOV
1053 3.8574 15.8652 3.8574 6.6172 \atfi@CURVETOY
1054 4.3325 5.418 5.1025 5.418 \atfi@CURVETOV
1055 5.8726 5.418 6.5845 5.418 \atfi@CURVETOY
1056 7.6812 5.6455 7.6812 6.4736 \atfi@CURVETOV
1057 7.6812 7.3027 7.6812 11.5264 \atfi@CURVETOY
1058 \atfi@STROKE
1059 0 \atfi@SETGRAYSTROKE
1060 1.2495 12.4404 \atfi@MOVETO
1061 1.2495 3.9883 1.2495 3.1895 \atfi@CURVETOV
1062 1.2495 2.3906 3.3833 1.9326 \atfi@CURVETOY
1063 6.7026 1.9326 \atfi@LINETO
1064 8.7178 2.5068 8.7178 3.9902 \atfi@CURVETOV
1065 8.7178 5.4736 8.7178 17.5781 \atfi@CURVETOY
1066 9.0732 18.834 7.769 18.834 \atfi@CURVETOV
1067 6.4653 18.834 4.4497 18.834 \atfi@CURVETOY
1068 3.146 18.6055 3.146 17.5781 \atfi@CURVETOV
1069 3.146 16.5498 3.146 7.3018 \atfi@CURVETOY
1070 3.6201 6.1016 4.3911 6.1016 \atfi@CURVETOV
1071 5.1611 6.1016 5.873 6.1016 \atfi@CURVETOY
1072 6.9692 6.3301 6.9692 7.1572 \atfi@CURVETOV
1073 6.9692 7.9863 6.9692 12.21 \atfi@CURVETOY
1074 \atfi@STROKE
1075 \atfi@color@inline{STROKE}%
1076 1 \atfi@SETLINEWIDTH
1077 1.2495 12.4404 \atfi@MOVETO
1078 1.2495 3.9883 1.2495 3.1895 \atfi@CURVETOV
1079 1.2495 2.3906 3.3833 1.9326 \atfi@CURVETOY
1080 6.7026 1.9326 \atfi@LINETO
1081 8.7178 2.5068 8.7178 3.9902 \atfi@CURVETOV
1082 8.7178 5.4736 8.7178 17.5781 \atfi@CURVETOY
1083 9.0732 18.834 7.769 18.834 \atfi@CURVETOV
1084 6.4653 18.834 4.4497 18.834 \atfi@CURVETOY
1085 3.146 18.6055 3.146 17.5781 \atfi@CURVETOV
1086 3.146 16.5498 3.146 7.3018 \atfi@CURVETOY
1087 3.6201 6.1016 4.3911 6.1016 \atfi@CURVETOV
1088 5.1611 6.1016 5.873 6.1016 \atfi@CURVETOY
1089 6.9692 6.3301 6.9692 7.1572 \atfi@CURVETOV
1090 6.9692 7.9863 6.9692 12.21 \atfi@CURVETOY
1091 \atfi@STROKE
1092 \atfi@GRESTORE
1093 }
1094 % \end{macrocode}
1095 % \end{macro}
1096 % \begin{macro}{\atfi@acroPaperclip}
1097 % \begin{macrocode}
1098 \def\atfi@acroPaperclip{%
1099 \raisebox{-1.25bp}{\parbox[b][21bp]{12bp}{%
1100 \rule{0pt}{0pt}\atfi@literal{\atfi@acroPaperclip@data}}%
1101 }%
1102 }
1103 % \end{macrocode}
1104 % \end{macro}
1105 % \begin{macro}{\atfi@acroPushPin@data}
1106 % \begin{macrocode}
1107 \def\atfi@acroPushPin@data{%
1108 \atfi@GSAVE
1109 1 \atfi@SETLINEWIDTH
1110 1 6 \atfi@MOVETO
1111 11 6 \atfi@LINETO
1112 11 13 \atfi@LINETO
1113 12 13 \atfi@LINETO
1114 14 11 \atfi@LINETO
1115 21 11 \atfi@LINETO
1116 22 12 \atfi@LINETO
1117 23 12 \atfi@LINETO
1118 23 2 \atfi@LINETO
1119 22 2 \atfi@LINETO
1120 21 3 \atfi@LINETO
1121 14 3 \atfi@LINETO
1122 12 1 \atfi@LINETO
1123 11 1 \atfi@LINETO
1124 11 6 \atfi@LINETO
1125 \atfi@FILLSTROKE{%
1126 \atfi@color@inline{FILL}%
1127 }{%
1128 0 \atfi@SETGRAYSTROKE
1129 }%
1130 0.5 \atfi@SETGRAYSTROKE
1131 0 7 \atfi@MOVETO
1132 10 7 \atfi@LINETO
1133 10 8 \atfi@LINETO
1134 1 8 \atfi@LINETO
1135 \atfi@STROKE
1136 1 \atfi@SETGRAYSTROKE
1137 12 12 \atfi@MOVETO
1138 14 10 \atfi@LINETO
1139 22 10 \atfi@LINETO
1140 22 11 \atfi@LINETO
1141 \atfi@STROKE
1142 \atfi@GRESTORE
1143 }
1144 % \end{macrocode}
1145 % \end{macro}
1146 % \begin{macro}{\atfi@acroPushPin}
1147 % \begin{macrocode}
1148 \def\atfi@acroPushPin{%
1149 \raisebox{-1.25bp}{\parbox[b][14bp]{24bp}{%
1150 \rule{0pt}{0pt}\atfi@literal{\atfi@acroPushPin@data}}%
1151 }%
1152 }
1153 % \end{macrocode}
1154 % \end{macro}
1155 % \begin{macro}{\atfi@acroTag@data}
1156 % \begin{macrocode}
1157 \def\atfi@acroTag@data{%
1158 \atfi@GSAVE
1159 0.5 \atfi@SETGRAYFILL
1160 10.0542 14.9873 \atfi@MOVETO
1161 24.27 14.9873 \atfi@LINETO
1162 25.252 14.0059 \atfi@LINETO
1163 25.252 1.1455 \atfi@LINETO
1164 24.1064 0 \atfi@LINETO
1165 9.9609 0 \atfi@LINETO
1166 6.0327 6.0088 \atfi@LINETO
1167 6.0327 9.002 \atfi@LINETO
1168 10.0542 14.9873 \atfi@LINETO
1169 9.3994 9.376 \atfi@MOVETO
1170 8.5215 9.376 7.8096 8.5596 7.8096 7.5527 \atfi@CURVETO
1171 7.8096 6.5449 8.5215 5.7285 9.3994 5.7285 \atfi@CURVETO
1172 10.2778 5.7285 10.9897 6.5449 10.9897 7.5527 \atfi@CURVETO
1173 10.9897 8.5596 10.2778 9.376 9.3994 9.376 \atfi@CURVETO
1174 \atfi@CLOSEPATH
1175 \atfi@FILL
1176 0 \atfi@SETFLAT
1177 0.5 \atfi@SETLINEWIDTH
1178 4 \atfi@SETMITERLIMIT
1179 1 \atfi@SETLINEJOIN
1180 8.5107 16.5313 \atfi@MOVETO
1181 22.7266 16.5313 \atfi@LINETO
1182 23.7085 15.5488 \atfi@LINETO
1183 23.7085 2.6895 \atfi@LINETO
1184 22.563 1.543 \atfi@LINETO
1185 8.4175 1.543 \atfi@LINETO
1186 4.4893 7.5527 \atfi@LINETO
1187 4.4893 10.5449 \atfi@LINETO
1188 8.5107 16.5313 \atfi@LINETO
1189 7.856 10.9199 \atfi@MOVETO
1190 6.978 10.9199 6.2661 10.1035 6.2661 9.0957 \atfi@CURVETO
1191 6.2661 8.0879 6.978 7.2715 7.856 7.2715 \atfi@CURVETO
1192 8.7344 7.2715 9.4463 8.0879 9.4463 9.0957 \atfi@CURVETO
1193 9.4463 10.1035 8.7344 10.9199 7.856 10.9199 \atfi@CURVETO
1194 \atfi@CLOSEPATH
1195 \atfi@FILLSTROKE{%
1196 \atfi@color@inline{FILL}%
1197 }{%
1198 0 \atfi@SETGRAYSTROKE
1199 }%
1200 1 \atfi@SETLINEWIDTH
1201 12.3291 12.2656 \atfi@MOVETO
1202 21.1206 12.2656 \atfi@LINETO
1203 \atfi@STROKE
1204 12.3291 9.1797 \atfi@MOVETO
1205 21.1206 9.1797 \atfi@LINETO
1206 \atfi@STROKE
1207 12.3291 6.1875 \atfi@MOVETO
1208 21.1206 6.1875 \atfi@LINETO
1209 \atfi@STROKE
1210 % 0 \atfi@SETGRAYSTROKE % redundant?
1211 0.5 \atfi@SETLINEWIDTH
1212 0 9.0488 \atfi@MOVETO
1213 6.2661 9.0957 \atfi@LINETO
1214 \atfi@STROKE
1215 1.4028 5.2148 \atfi@MOVETO
1216 1.4028 9.6094 \atfi@LINETO
1217 1.6831 10.6387 2.4316 10.6387 \atfi@CURVETOV
1218 3.6475 10.6387 3.5542 9.0488 \atfi@CURVETOY
1219 \atfi@STROKE
1220 \atfi@GRESTORE
1221 }
1222 % \end{macrocode}
1223 % \end{macro}
1224 % \begin{macro}{\atfi@acroTag}
1225 % \begin{macrocode}
1226 \def\atfi@acroTag{%
1227 \raisebox{-1.6bp}{\parbox[b][17bp]{25bp}{%
1228 \rule{0pt}{0pt}\atfi@literal{\atfi@acroTag@data}}%
1229 }%
1230 }
1231 % \end{macrocode}
1232 % \end{macro}
1233 %
1234 % \subsubsection{Reading the \xext{atfi} file}
1235 %
1236 % Commands used in \cs{jobname}\xext{atfi}:
1237 % \begin{itemize}
1238 % \item |attachfile@timezone{<timezone in PDF format>}|
1239 % \item
1240 %\begin{verbatim}
1241 %\attachfile@file[
1242 % Size=<size>,
1243 % CreationDate=<date>, % <date> local time without "D:" and timezone
1244 % ModDateTZ=<date+TZ>,
1245 % ModDate=<date>,
1246 % CheckSum=<checksum>
1247 %]{<filename as hex string>}
1248 %\end{verbatim}
1249 % \end{itemize}
1250 %
1251 % \begin{macro}{\attachfile@timezone}
1252 % \begin{macrocode}
1253 \def\attachfile@timezone#1{%
1254 \ifx\\#1\\%
1255 % no timezone information given
1256 \else
1257 \def\atfi@timezone{#1}%
1258 \fi
1259 }
1260 % \end{macrocode}
1261 % \end{macro}
1262 % \begin{macro}{\attachfile@file}
1263 % \begin{macrocode}
1264 \newcommand*{\attachfile@file}[2][]{%
1265 \EdefUnescapeHex\atfi@filename{#2}%
1266 \ifx\atfi@filename\ltx@empty
1267 \PackageError{attachfile2}{Empty file name}\@ehc
1268 \else
1269 \@namedef{atfi@file@\atfi@filename}{#1}%
1270 \fi
1271 }
1272 % \end{macrocode}
1273 % \end{macro}
1274 %
1275 % \begin{macrocode}
1276 \InputIfFileExists{\jobname.atfi}{}{}%
1277 % \end{macrocode}
1278 %
1279 % \begin{macrocode}
1280 \newif\ifatfi@checksum
1281 \define@key{AtFi@file}{CheckSum}{%
1282 \atfi@checksumtrue
1283 \edef\atfi@params{\atfi@params/CheckSum<#1>}%
1284 }
1285 % \end{macrocode}
1286 % \begin{macrocode}
1287 \newif\ifatfi@creationdate
1288 \define@key{AtFi@file}{CreationDateTZ}{%
1289 \ifatfi@creationdate
1290 \else
1291 \atfi@creationdatetrue
1292 \edef\atfi@params{%
1293 \atfi@params
1294 /CreationDate(#1)%
1295 }%
1296 \fi
1297 }
1298 % \end{macrocode}
1299 % \begin{macrocode}
1300 \define@key{AtFi@file}{CreationDate}{%
1301 \ifatfi@creationdate
1302 \else
1303 \atfi@creationdatetrue
1304 \edef\atfi@params{%
1305 \atfi@params
1306 /CreationDate(#1\atfi@timezone)%
1307 }%
1308 \fi
1309 }
1310 % \end{macrocode}
1311 % \begin{macrocode}
1312 \newif\ifatfi@moddate
1313 \define@key{AtFi@file}{ModDateTZ}{%
1314 \ifatfi@moddate
1315 \else
1316 \atfi@moddatetrue
1317 \edef\atfi@params{%
1318 \atfi@params
1319 /ModDate(#1)%
1320 }%
1321 \fi
1322 }
1323 % \end{macrocode}
1324 % \begin{macrocode}
1325 \define@key{AtFi@file}{ModDate}{%
1326 \ifatfi@moddate
1327 \else
1328 \atfi@moddatetrue
1329 \edef\atfi@params{%
1330 \atfi@params
1331 /ModDate(D:#1\atfi@timezone)%
1332 }%
1333 \fi
1334 }
1335 % \end{macrocode}
1336 %
1337 % \begin{macro}{\atfi@pdftexdata}
1338 % \begin{macrocode}
1339 \let\atfi@temp\ltx@one
1340 \ltx@IfUndefined{pdf@filesize}{%
1341 \let\atfi@temp\ltx@zero
1342 }{}
1343 \ltx@IfUndefined{pdf@filemoddate}{%
1344 \let\atfi@temp\ltx@zero
1345 }{}
1346 \ltx@IfUndefined{pdf@filemdfivesum}{%
1347 \let\atfi@temp\ltx@zero
1348 }{}
1349 \ifcase\atfi@temp
1350 \let\atfi@pdftexdata\ltx@gobble
1351 \or
1352 \def\atfi@pdftexdata#1{%
1353 \edef\atfi@temp{\pdf@filesize{#1}}%
1354 \ifx\atfi@temp\ltx@empty
1355 \else
1356 \setkeys{AtFi@file}{Size=\atfi@temp}%
1357 \edef\atfi@temp{\pdf@filemoddate{#1}}%
1358 \ifx\atfi@temp\ltx@empty
1359 \else
1360 \setkeys{AtFi@file}{ModDateTZ=\atfi@temp}%
1361 \fi
1362 \edef\atfi@temp{\pdf@filemdfivesum{#1}}%
1363 \ifx\atfi@temp\ltx@empty
1364 \else
1365 \setkeys{AtFi@file}{CheckSum=\atfi@temp}%
1366 \fi
1367 \fi
1368 }%
1369 \fi
1370 % \end{macrocode}
1371 % \end{macro}
1372 %
1373 % \subsubsection{Writing the \xext{atfi} file}
1374 %
1375 % Respect \cs{nofiles} and option \xoption{nofiles}.
1376 % \cs{nofiles} has more weight than option \xoption{nofiles}.
1377 % \begin{macrocode}
1378 \if@filesw
1379 \else
1380 \atfi@nofilestrue
1381 \fi
1382 \ifatfi@nofiles
1383 \PackageInfo{attachfile2}{%
1384 File `\jobname.atfi' will not be written because of\MessageBreak
1385 \string\nofiles\space or option `nofiles'%
1386 }%
1387 % \end{macrocode}
1388 % \begin{macro}{\atfi@writefile}
1389 % \begin{macrocode}
1390 \let\atfi@writefile\ltx@gobble
1391 % \end{macrocode}
1392 % \end{macro}
1393 % \begin{macrocode}
1394 \else
1395 % \end{macrocode}
1396 % \begin{macro}{\atfi@stream}
1397 % \begin{macrocode}
1398 \newwrite\atfi@stream
1399 % \end{macrocode}
1400 % \end{macro}
1401 % \begin{macrocode}
1402 \immediate\openout\atfi@stream=\jobname.atfi\relax
1403 \immediate\write\atfi@stream{%
1404 \string\attachfile@timezone{\atfi@timezone}%
1405 }%
1406 % \end{macrocode}
1407 % \begin{macro}{\atfi@writefile}
1408 % \begin{macrocode}
1409 \def\atfi@writefile#1{%
1410 \begingroup
1411 \EdefEscapeHex\atfi@temp{#1}%
1412 \immediate\write\atfi@stream{%
1413 \string\attachfile@file[%
1414 \ltx@ifundefined{atfi@file@#1}{}{\@nameuse{atfi@file@#1}}%
1415 ]{\atfi@temp}%
1416 }%
1417 \endgroup
1418 }%
1419 % \end{macrocode}
1420 % \end{macro}
1421 % \begin{macrocode}
1422 \fi
1423 \atfi@DisableOption{nofiles}
1424 % \end{macrocode}
1425 %
1426 % \begin{macro}{\atfi@attachfile}
1427 % \begin{macrocode}
1428 \def\atfi@attachfile#1#2{%
1429 \ltx@IfUndefined{atfi@fileobj@#2}{%
1430 \atfi@writefile{#2}%
1431 }{%
1432 % don't need duplicates
1433 }%
1434 \atfi@setup{#1}%
1435 \atfi@embedfile{#2}%
1436 \atfi@set@appearance@icon
1437 \atfi@flags@to@int
1438 \atfi@insert@file@annot{#2}%
1439 \endgroup
1440 }
1441 % \end{macrocode}
1442 % \end{macro}
1443 %
1444 % \subsubsection{Annotation appearance}
1445 %
1446 % \begin{macro}{\atfi@appearancewidth}
1447 % \begin{macrocode}
1448 \newlength{\atfi@appearancewidth}
1449 % \end{macrocode}
1450 % \end{macro}
1451 % \begin{macro}{\atfi@appearanceheight}
1452 % \begin{macrocode}
1453 \newlength{\atfi@appearanceheight}
1454 % \end{macrocode}
1455 % \end{macro}
1456 % \begin{macro}{\atfi@appearancedepth}
1457 % \begin{macrocode}
1458 \newlength{\atfi@appearancedepth}
1459 % \end{macrocode}
1460 % \end{macro}
1461 % \begin{macro}{\atfi@appearancebox}
1462 % \begin{macrocode}
1463 \newsavebox{\atfi@appearancebox}
1464 % \end{macrocode}
1465 % \end{macro}
1466 %
1467 % \begin{macro}{\atfi@set@appearance@icon}
1468 % \begin{macrocode}
1469 \def\atfi@set@appearance@icon{%
1470 \ltx@IfUndefined{atfi@appobj@\atfi@icon@icon}{%
1471 \savebox{\atfi@appearancebox}{%
1472 \@nameuse{atfi@acro\atfi@icon@icon}%
1473 }%
1474 \expandafter
1475 \xdef\csname atfi@appwidth@\atfi@icon@icon\endcsname{%
1476 \the\wd\atfi@appearancebox
1477 }%
1478 \expandafter
1479 \xdef\csname atfi@appheight@\atfi@icon@icon\endcsname{%
1480 \the\ht\atfi@appearancebox
1481 }%
1482 \expandafter
1483 \xdef\csname atfi@appdepth@\atfi@icon@icon\endcsname{%
1484 \the\dp\atfi@appearancebox
1485 }%
1486 \atfi@xform@icon
1487 \global\expandafter\let
1488 \csname atfi@appobj@\atfi@icon@icon\endcsname
1489 \atfi@appearanceobj
1490 }{%
1491 }%
1492 % optimization: \setlength dropped
1493 \atfi@appearancewidth=%
1494 \@nameuse{atfi@appwidth@\atfi@icon@icon}\relax
1495 \atfi@appearanceheight=%
1496 \@nameuse{atfi@appheight@\atfi@icon@icon}\relax
1497 \atfi@appearancedepth=%
1498 \@nameuse{atfi@appdepth@\atfi@icon@icon}\relax
1499 \expandafter\let\expandafter\atfi@appearanceobj
1500 \csname atfi@appobj@\atfi@icon@icon\endcsname
1501 }
1502 % \end{macrocode}
1503 % \end{macro}
1504 %
1505 % \begin{macro}{\atfi@set@appearance}
1506 % \begin{macrocode}
1507 \def\atfi@set@appearance#1{%
1508 \savebox{\atfi@appearancebox}{#1}%
1509 \atfi@appearancewidth=\wd\atfi@appearancebox
1510 \atfi@appearanceheight=\ht\atfi@appearancebox
1511 \atfi@appearancedepth=\dp\atfi@appearancebox
1512 \atfi@xform
1513 }
1514 % \end{macrocode}
1515 % \end{macro}
1516 %
1517 % \begin{macrocode}
1518 \newcounter{atfi@flags}
1519 % \end{macrocode}
1520 % \begin{macro}{\atfi@flags@to@int}
1521 % \begin{macrocode}
1522 \DeclareRobustCommand{\atfi@flags@to@int}{%
1523 \setcounter{atfi@flags}{0}%
1524 \ifatfi@print
1525 \addtocounter{atfi@flags}{4}%
1526 \fi%
1527 \ifatfi@zoom
1528 \else
1529 \addtocounter{atfi@flags}{8}%
1530 \fi%
1531 \ifatfi@locked
1532 \addtocounter{atfi@flags}{128}%
1533 \fi%
1534 }
1535 % \end{macrocode}
1536 % \end{macro}
1537 %
1538 % \begin{macro}{\atfi@textattachfile}
1539 % \begin{macrocode}
1540 \def\atfi@textattachfile#1#2{%
1541 \endgroup
1542 \atfi@textattachfile@i{#1}{#2}%
1543 }
1544 % \end{macrocode}
1545 % \end{macro}
1546 % \begin{macro}{\atfi@textattachfile@i}
1547 % \begin{macrocode}
1548 \def\atfi@textattachfile@i#1#2#3{%
1549 \ltx@IfUndefined{atfi@fileobj@#2}{%
1550 \atfi@writefile{#2}%
1551 }{%
1552 % don't need duplicates
1553 }%
1554 \atfi@setup{#1}%
1555 \atfi@embedfile{#2}%
1556 \atfi@set@appearance{%
1557 \leavevmode
1558 \begingroup
1559 \HyColor@UseColor\atfi@color@tex
1560 #3\strut
1561 \endgroup
1562 }%
1563 \atfi@flags@to@int
1564 \atfi@insert@file@annot{#2}%
1565 \endgroup
1566 }
1567 % \end{macrocode}
1568 % \end{macro}
1569 %
1570 % \begin{macro}{\attachfile}
1571 % \begin{macrocode}
1572 \DeclareRobustCommand{\attachfile}[1][]{%
1573 \begingroup
1574 \let\do\@makeother
1575 \dospecials
1576 \catcode`\{=1\relax
1577 \catcode`\}=2\relax
1578 \atfi@attachfile{#1}%
1579 }
1580 % \end{macrocode}
1581 % \end{macro}
1582 % \begin{macro}{\textattachfile}
1583 % \begin{macrocode}
1584 \DeclareRobustCommand{\textattachfile}[1][]{%
1585 \begingroup
1586 \begingroup
1587 \let\do\@makeother
1588 \dospecials
1589 \catcode`\{=1\relax
1590 \catcode`\}=2\relax
1591 \atfi@textattachfile{#1}%
1592 }
1593 % \end{macrocode}
1594 % \end{macro}
1595 % \begin{macro}{\noattachfile}
1596 % \begin{macrocode}
1597 \DeclareRobustCommand{\noattachfile}[1][]{%
1598 \begingroup
1599 \atfi@setup{#1}%
1600 \atfi@set@appearance@icon
1601 \ifatfi@print
1602 \expandafter
1603 \atfi@refxform\csname atfi@appobj@\atfi@icon@icon\endcsname
1604 \else
1605 \makebox[\atfi@appearancewidth]{}%
1606 \fi
1607 \endgroup
1608 }
1609 % \end{macrocode}
1610 % \end{macro}
1611 %
1612 % \begin{macrocode}
1613 %</package>
1614 % \end{macrocode}
1615 %
1616 % \subsection{Drivers}
1617 %
1618 % \subsubsection{\pdfTeX}
1619 %
1620 % \begin{macrocode}
1621 %<*pdftex>
1622 \NeedsTeXFormat{LaTeX2e}
1623 \ProvidesFile{atfi-pdftex.def}%
1624 [2024-01-18 v2.12 attachfile2 driver for pdfTeX (HO)]%
1625 % \end{macrocode}
1626 %
1627 % \paragraph{Macros for graphics data}
1628 %
1629 % \begin{macro}{\atfi@literal}
1630 % \begin{macrocode}
1631 \let\atfi@literal\pdfliteral
1632 % \end{macrocode}
1633 % \end{macro}
1634 %
1635 % \begin{macrocode}
1636 \def\atfi@GSAVE{q }
1637 \def\atfi@GRESTORE{Q }
1638 \def\atfi@SETLINEWIDTH{w }
1639 \def\atfi@LINETO{l }
1640 \def\atfi@MOVETO{m }
1641 \def\atfi@STROKE{S }
1642 \def\atfi@FILL{f }
1643 % \atfi@FILLSTROKE{<fill color>}{<stroke color>}
1644 \def\atfi@FILLSTROKE#1#2{#1#2B }
1645 % \end{macrocode}
1646 % color: uppercase are stroke colors, lowercase non-stroke (fill) colors
1647 % PS, however, does not different between stroke and not-stroke colors
1648 % \begin{macrocode}
1649 \def\atfi@SETRGBCOLORSTROKE{RG }
1650 \def\atfi@SETRGBCOLORFILL{rg }
1651 \def\atfi@SETGRAYSTROKE{G }
1652 \def\atfi@SETGRAYFILL{g }
1653 \def\atfi@SETCMYKCOLORSTROKE{K }
1654 \def\atfi@SETCMYKCOLORFILL{k }
1655 \def\atfi@RECTFILL{re f }
1656 \def\atfi@RECTSTROKEFILL#1#2#3{#1#2#3re B }
1657 \def\atfi@SETMITERLIMIT{M }
1658 \def\atfi@SETFLAT{i }
1659 \def\atfi@SETLINECAP{J }
1660 \def\atfi@CURVETO{c }
1661 \def\atfi@CURVETOV{v }
1662 \def\atfi@CURVETOY{y }
1663 \def\atfi@CLOSEPATH{h }
1664 \def\atfi@SETLINEJOIN{j }
1665 % \end{macrocode}
1666 %
1667 % \paragraph{File embedding}
1668 %
1669 % \begin{macrocode}
1670 \define@key{AtFi@file}{Size}{%
1671 \edef\atfi@params{\atfi@params/Size #1}%
1672 }
1673 % \end{macrocode}
1674 % \begin{macro}{\atfi@embedfile}
1675 % \begin{macrocode}
1676 \def\atfi@embedfile#1{%
1677 \ltx@IfUndefined{atfi@fileobj@#1}{%
1678 \begingroup
1679 \let\atfi@params\ltx@empty
1680 \expandafter\let\expandafter\atfi@temp
1681 \csname atfi@file@#1\endcsname
1682 \ifx\atfi@temp\ltx@empty
1683 \let\atfi@temp\relax
1684 \fi
1685 \ifx\atfi@temp\relax
1686 \atfi@pdftexdata{#1}%
1687 \else
1688 \edef\x{%
1689 \noexpand\setkeys{AtFi@file}{\@nameuse{atfi@file@#1}}%
1690 }%
1691 \x
1692 \fi
1693 \ifx\atfi@params\ltx@empty
1694 \else
1695 \edef\atfi@params{/Params<<\atfi@params>>}%
1696 \fi
1697 \immediate\pdfobj stream attr {%
1698 /Type/EmbeddedFile%
1699 \atfi@mimetype
1700 \atfi@params
1701 } file {#1}%
1702 \expandafter
1703 \xdef\csname atfi@fileobj@#1\endcsname{\the\pdflastobj}%
1704 \endgroup
1705 }{%
1706 % file already embedded
1707 }%
1708 }
1709 % \end{macrocode}
1710 % \end{macro}
1711 %
1712 % \paragraph{Annotation appearance}
1713 %
1714 % \begin{macro}{\atfi@xform}
1715 % input: \cs{atfi@appearancebox}, output: \cs{atfi@appearanceobj}
1716 % \begin{macrocode}
1717 \def\atfi@xform{%
1718 \immediate\pdfxform\atfi@appearancebox
1719 \edef\atfi@appearanceobj{\the\pdflastxform}%
1720 }
1721 % \end{macrocode}
1722 % \end{macro}
1723 % \begin{macro}{\atfi@xform@icon}
1724 % \begin{macrocode}
1725 \let\atfi@xform@icon\atfi@xform
1726 % \end{macrocode}
1727 % \end{macro}
1728 %
1729 % \begin{macro}{\atfi@refxform}
1730 % \begin{macrocode}
1731 \def\atfi@refxform#1{%
1732 \pdfrefxform#1\relax
1733 }
1734 % \end{macrocode}
1735 % \end{macro}
1736 %
1737 % \paragraph{File attachment annotation}
1738 %
1739 % \begin{macro}{\atfi@insert@file@annot}
1740 % \begin{macrocode}
1741 \def\atfi@insert@file@annot#1{%
1742 \rule{0pt}{0pt}%
1743 \ifatfi@appearance
1744 \def\atfi@appearance@dict{%
1745 /AP<<%
1746 /N \atfi@appearanceobj\space 0 R%
1747 /R \atfi@appearanceobj\space 0 R%
1748 /D \atfi@appearanceobj\space 0 R%
1749 >>%
1750 }%
1751 \else
1752 \let\atfi@appearance@dict\ltx@empty
1753 \fi
1754 \ltx@IfUndefined{atfi@fsobj@#1}{%
1755 \begingroup
1756 \hypersetup{unicode=false}%
1757 \atfi@pdfstringdef\atfi@file{#1}%
1758 \immediate\pdfobj{%
1759 <<%
1760 /Type/Filespec%
1761 /F(\atfi@file)%
1762 \ifx\atfi@ucfilespec\ltx@empty
1763 \else
1764 /UF(\atfi@ucfilespec)%
1765 \fi
1766 /EF<<%
1767 /F \@nameuse{atfi@fileobj@#1} 0 R%
1768 >>%
1769 >>%
1770 }%
1771 \expandafter\xdef\csname atfi@fsobj@#1\endcsname{%
1772 \the\pdflastobj
1773 }%
1774 \endgroup
1775 }{%
1776 }%
1777 \pdfannot width \atfi@scale\atfi@appearancewidth
1778 height \atfi@scale\atfi@appearanceheight
1779 depth \atfi@scale\atfi@appearancedepth {%
1780 /Subtype/FileAttachment%
1781 \atfi@icon
1782 \atfi@color@annot
1783 \atfi@author
1784 \atfi@date
1785 \atfi@annotname
1786 \atfi@description
1787 \atfi@subject
1788 \atfi@appearance@dict
1789 /F \theatfi@flags
1790 /FS \@nameuse{atfi@fsobj@#1} 0 R%
1791 }%
1792 \rule{0pt}{\atfi@appearanceheight}%
1793 \rule[-\atfi@appearancedepth]{0pt}{\atfi@appearancedepth}%
1794 \rule{\atfi@appearancewidth}{0pt}%
1795 }
1796 % \end{macrocode}
1797 % \end{macro}
1798 %
1799 % \begin{macrocode}
1800 %</pdftex>
1801 % \end{macrocode}
1802 %
1803 % \subsection{luatex}
1804 % \begin{macrocode}
1805 %<*luatex>
1806 \NeedsTeXFormat{LaTeX2e}
1807 \ProvidesFile{atfi-luatex.def}%
1808 [2024-01-18 v2.12 attachfile2 driver for luaTeX (HO)]%
1809 \protected\def\atfi@literal {\pdfextension literal}
1810 \def\atfi@GSAVE{q }
1811 \def\atfi@GRESTORE{Q }
1812 \def\atfi@SETLINEWIDTH{w }
1813 \def\atfi@LINETO{l }
1814 \def\atfi@MOVETO{m }
1815 \def\atfi@STROKE{S }
1816 \def\atfi@FILL{f }
1817 \def\atfi@FILLSTROKE#1#2{#1#2B }
1818 \def\atfi@SETRGBCOLORSTROKE{RG }
1819 \def\atfi@SETRGBCOLORFILL{rg }
1820 \def\atfi@SETGRAYSTROKE{G }
1821 \def\atfi@SETGRAYFILL{g }
1822 \def\atfi@SETCMYKCOLORSTROKE{K }
1823 \def\atfi@SETCMYKCOLORFILL{k }
1824 \def\atfi@RECTFILL{re f }
1825 \def\atfi@RECTSTROKEFILL#1#2#3{#1#2#3re B }
1826 \def\atfi@SETMITERLIMIT{M }
1827 \def\atfi@SETFLAT{i }
1828 \def\atfi@SETLINECAP{J }
1829 \def\atfi@CURVETO{c }
1830 \def\atfi@CURVETOV{v }
1831 \def\atfi@CURVETOY{y }
1832 \def\atfi@CLOSEPATH{h }
1833 \def\atfi@SETLINEJOIN{j }
1834 \define@key{AtFi@file}{Size}{%
1835 \edef\atfi@params{\atfi@params/Size #1}%
1836 }
1837 \def\atfi@embedfile#1{%
1838 \ltx@IfUndefined{atfi@fileobj@#1}{%
1839 \begingroup
1840 \let\atfi@params\ltx@empty
1841 \expandafter\let\expandafter\atfi@temp
1842 \csname atfi@file@#1\endcsname
1843 \ifx\atfi@temp\ltx@empty
1844 \let\atfi@temp\relax
1845 \fi
1846 \ifx\atfi@temp\relax
1847 \atfi@pdftexdata{#1}%
1848 \else
1849 \edef\x{%
1850 \noexpand\setkeys{AtFi@file}{\@nameuse{atfi@file@#1}}%
1851 }%
1852 \x
1853 \fi
1854 \ifx\atfi@params\ltx@empty
1855 \else
1856 \edef\atfi@params{/Params<<\atfi@params>>}%
1857 \fi
1858 \immediate\pdfextension obj stream attr {%
1859 /Type/EmbeddedFile%
1860 \atfi@mimetype
1861 \atfi@params
1862 } file {#1}%
1863 \expandafter
1864 \xdef\csname atfi@fileobj@#1\endcsname{\the\numexpr\pdffeedback lastobj\relax}%
1865 \endgroup
1866 }{%
1867 % file already embedded
1868 }%
1869 }
1870 \def\atfi@xform{%
1871 \immediate\saveboxresource\atfi@appearancebox
1872 \edef\atfi@appearanceobj{\the\lastsavedboxresourceindex}%
1873 }
1874 \let\atfi@xform@icon\atfi@xform
1875 \def\atfi@refxform#1{%
1876 \useboxresource#1\relax
1877 }
1878 \def\atfi@insert@file@annot#1{%
1879 \rule{0pt}{0pt}%
1880 \ifatfi@appearance
1881 \def\atfi@appearance@dict{%
1882 /AP<<%
1883 /N \atfi@appearanceobj\space 0 R%
1884 /R \atfi@appearanceobj\space 0 R%
1885 /D \atfi@appearanceobj\space 0 R%
1886 >>%
1887 }%
1888 \else
1889 \let\atfi@appearance@dict\ltx@empty
1890 \fi
1891 \ltx@IfUndefined{atfi@fsobj@#1}{%
1892 \begingroup
1893 \hypersetup{unicode=false}%
1894 \atfi@pdfstringdef\atfi@file{#1}%
1895 \immediate\pdfextension obj{%
1896 <<%
1897 /Type/Filespec%
1898 /F(\atfi@file)%
1899 \ifx\atfi@ucfilespec\ltx@empty
1900 \else
1901 /UF(\atfi@ucfilespec)%
1902 \fi
1903 /EF<<%
1904 /F \@nameuse{atfi@fileobj@#1} 0 R%
1905 >>%
1906 >>%
1907 }%
1908 \expandafter\xdef\csname atfi@fsobj@#1\endcsname{%
1909 \the\numexpr\pdffeedback lastobj\relax
1910 }%
1911 \endgroup
1912 }{%
1913 }%
1914 \pdfextension annot width \atfi@scale\atfi@appearancewidth
1915 height \atfi@scale\atfi@appearanceheight
1916 depth \atfi@scale\atfi@appearancedepth {%
1917 /Subtype/FileAttachment%
1918 \atfi@icon
1919 \atfi@color@annot
1920 \atfi@author
1921 \atfi@date
1922 \atfi@annotname
1923 \atfi@description
1924 \atfi@subject
1925 \atfi@appearance@dict
1926 /F \theatfi@flags
1927 /FS \@nameuse{atfi@fsobj@#1} 0 R%
1928 }%
1929 \rule{0pt}{\atfi@appearanceheight}%
1930 \rule[-\atfi@appearancedepth]{0pt}{\atfi@appearancedepth}%
1931 \rule{\atfi@appearancewidth}{0pt}%
1932 }
1933 %</luatex>
1934 % \end{macrocode}
1935 %
1936 % \subsubsection{dvips}
1937 %
1938 % \begin{macrocode}
1939 %<*dvips>
1940 \NeedsTeXFormat{LaTeX2e}
1941 \ProvidesFile{atfi-dvips.def}%
1942 [2024-01-18 v2.12 attachfile2 driver for dvips (HO)]%
1943 % \end{macrocode}
1944 %
1945 % \paragraph{Macros for graphics data}
1946 %
1947 % \begin{macro}{\atfi@literal}
1948 % \begin{macrocode}
1949 \def\atfi@literal#1{%
1950 \special{ps:atfi_dict begin{#1}atfi_?pdfmark end}%
1951 }
1952 % \end{macrocode}
1953 % \end{macro}
1954 % \begin{macro}{\atfi@header}
1955 % \begin{macrocode}
1956 \def\atfi@header#1{%
1957 \special{! #1}%
1958 }
1959 % \end{macrocode}
1960 % \end{macro}
1961 %
1962 % \begin{macrocode}
1963 \atfi@header{%
1964 userdict begin 20 dict dup /atfi_dict exch def end begin%
1965 /atfi_?pdfmark systemdict %
1966 dup/pdfmark known%
1967 {%
1968 /exec get def%
1969 }{%
1970 /pop get def%
1971 } ifelse%
1972 {%
1973 %
1974 % x y width height atfi_re ->
1975 languagelevel 2 ge {%
1976 /atfi_rectfill { rectfill } bind def%
1977 /atfi_rectstroke { rectstroke } bind def%
1978 }{%
1979 /atfi_rect {%
1980 /atfi_height exch def%
1981 /atfi_width exch def%
1982 /atfi_x exch def%
1983 /atfi_y exch def %
1984 newpath %
1985 atfi_x atfi_y moveto %
1986 atfi_x atfi_width add atfi_y lineto %
1987 atfi_x atfi_width add atfi_y atfi_height add lineto %
1988 atfi_x atfi_y atfi_height add lineto %
1989 closepath%
1990 } bind def%
1991 /atfi_rectfill {%
1992 atfi_rect fill%
1993 } bind def%
1994 /atfi_rectstroke {%
1995 atfi_rect stroke%
1996 } bind def%
1997 } ifelse%
1998 /atfi_curveto_v {%
1999 currentpoint 6 2 roll curveto%
2000 } bind def%
2001 /atfi_curveto_y {%
2002 2 copy curveto%
2003 } bind def%
2004 %
2005 % help macro for atfi_convert_date
2006 /atfi_two {%
2007 dup 10 lt%
2008 {%
2009 1 string cvs %
2010 exch 1 add exch%
2011 }{%
2012 2 string cvs%
2013 } ifelse %
2014 putinterval%
2015 } bind def%
2016 %
2017 % <seconds since 1970-01-01> atfi_convert_date -> (D:...Z)
2018 /atfi_convert_date {%
2019 dup%
2020 /atfi_days exch 3600 idiv 24 idiv def%
2021 % calc date part
2022 /atfi_year 1970 def%
2023 {%
2024 atfi_year 400 mod 0 eq %
2025 atfi_year 100 mod 0 ne %
2026 atfi_year 4 mod 0 eq %
2027 and or%
2028 {366} {365} ifelse %
2029 dup atfi_days lt%
2030 {%
2031 atfi_days exch sub /atfi_days exch def%
2032 /atfi_year atfi_year 1 add def%
2033 }{%
2034 exit%
2035 } ifelse%
2036 } loop%
2037 /atfi_month 1 def%
2038 /atfi_days atfi_days 1 add def %
2039 31 atfi_days lt%
2040 {%
2041 atfi_days 31 sub /atfi_days exch def%
2042 /atfi_month atfi_month 1 add def %
2043 366 eq {29} {28} ifelse dup atfi_days lt%
2044 {%
2045 atfi_days exch sub /atfi_days exch def%
2046 /atfi_month atfi_month 1 add def %
2047 31 atfi_days lt%
2048 {%
2049 atfi_days 31 sub /atfi_days exch def%
2050 /atfi_month atfi_month 1 add def %
2051 30 atfi_days lt%
2052 {%
2053 atfi_days 30 sub /atfi_days exch def%
2054 /atfi_month atfi_month 1 add def %
2055 31 atfi_days lt%
2056 {%
2057 atfi_days 31 sub /atfi_days exch def%
2058 /atfi_month atfi_month 1 add def %
2059 30 atfi_days lt%
2060 {%
2061 atfi_days 30 sub /atfi_days exch def%
2062 /atfi_month atfi_month 1 add def %
2063 31 atfi_days lt%
2064 {%
2065 atfi_days 31 sub /atfi_days exch def%
2066 /atfi_month atfi_month 1 add def %
2067 31 atfi_days lt%
2068 {%
2069 atfi_days 31 sub /atfi_days exch def%
2070 /atfi_month atfi_month 1 add def %
2071 30 atfi_days lt%
2072 {%
2073 atfi_days 30 sub /atfi_days exch def%
2074 /atfi_month atfi_month 1 add def %
2075 31 atfi_days lt%
2076 {%
2077 atfi_days 31 sub /atfi_days exch def%
2078 /atfi_month atfi_month 1 add def %
2079 30 atfi_days lt%
2080 {%
2081 atfi_days 30 sub /atfi_days exch def%
2082 /atfi_month atfi_month 1 add def %
2083 31 atfi_days lt%
2084 {%
2085 atfi_days 31 sub /atfi_days exch def%
2086 /atfi_month atfi_month 1 add def%
2087 } if%
2088 } if%
2089 } if%
2090 } if%
2091 } if%
2092 } if%
2093 } if%
2094 } if%
2095 } if%
2096 } if%
2097 } { pop } ifelse%
2098 }{ pop } ifelse %
2099 % calc time part
2100 3600 24 mul mod %
2101 dup 3600 idiv dup /atfi_hour exch def %
2102 3600 mul sub %
2103 dup 60 idiv dup /atfi_min exch def %
2104 60 mul sub %
2105 /atfi_sec exch def%
2106 (D:19700101000000Z)%
2107 dup 2 atfi_year 4 string cvs putinterval %
2108 dup 6 atfi_month atfi_two %
2109 dup 8 atfi_days atfi_two %
2110 dup 10 atfi_hour atfi_two %
2111 dup 12 atfi_min atfi_two %
2112 dup 14 atfi_sec atfi_two%
2113 } bind def %
2114 %
2115 % <filename> atfi_calc_checksum -> /CheckSum <checksum>
2116 % or returns nothing, if MD5Encode is not given
2117 false %
2118 languagelevel 2 ge {%
2119 (MD5Encode)%
2120 { pop true or }%
2121 (MD5Encode) length string%
2122 /Filter %
2123 resourceforall%
2124 } if%
2125 {%
2126 /atfi_calc_checksum {%
2127 /atfi_checksum 16 string def%
2128 /atfi_file exch (r) file def%
2129 /atfi_md5sum atfi_checksum /MD5Encode filter def %
2130 % not too efficient to read and write byte by byte,
2131 % using a buffer is probably faster
2132 atfi_size {%
2133 atfi_file read%
2134 {%
2135 atfi_md5sum exch write%
2136 } if%
2137 } repeat %
2138 atfi_md5sum closefile %
2139 atfi_file closefile%
2140 /CheckSum atfi_checksum%
2141 } bind def%
2142 }{%
2143 /atfi_calc_checksum { pop } bind def%
2144 } ifelse%
2145 %
2146 /atfi_pttobp { 72.27 div 72 mul } bind def%
2147 /atfi_pdftodvipsx { 72.27 div Resolution mul } bind def%
2148 /atfi_pdftodvipsy { 72.27 div VResolution mul } bind def%
2149 %
2150 } atfi_?pdfmark %
2151 end%
2152 }
2153 % \end{macrocode}
2154 % \begin{macrocode}
2155 \def\atfi@GSAVE{gsave }
2156 \def\atfi@GRESTORE{grestore }
2157 \def\atfi@SETLINEWIDTH{setlinewidth }
2158 \def\atfi@LINETO{lineto }
2159 \def\atfi@MOVETO{moveto }
2160 \def\atfi@STROKE{stroke }
2161 \def\atfi@FILL{fill }
2162 \def\atfi@FILLSTROKE#1#2{gsave #1 fill grestore #2 stroke }
2163 \def\atfi@SETRGBCOLORSTROKE{setrgbcolor }
2164 \def\atfi@SETRGBCOLORFILL{setrgbcolor }
2165 \def\atfi@SETGRAYSTROKE{setgray }
2166 \def\atfi@SETGRAYFILL{setgray }
2167 \def\atfi@SETCMYKCOLORSTROKE{setcmykcolor }
2168 \def\atfi@SETCMYKCOLORFILL{setcmykcolor }
2169 \def\atfi@RECTFILL{atfi_rectfill }
2170 \def\atfi@RECTSTROKEFILL#1#2#3{%
2171 #3%
2172 #1%
2173 gsave atfi_rectfill grestore %
2174 #2%
2175 #3%
2176 atfi_rectstroke %
2177 #1%
2178 }
2179 \def\atfi@SETMITERLIMIT{setmiterlimit }
2180 \def\atfi@SETFLAT{setflat }
2181 \def\atfi@SETLINECAP{setlinecap }
2182 \def\atfi@CURVETO{curveto }
2183 \def\atfi@CURVETOV{atfi_curveto_v }
2184 \def\atfi@CURVETOY{atfi_curveto_y }
2185 \def\atfi@CLOSEPATH{closepath }
2186 \def\atfi@SETLINEJOIN{setlinejoin }
2187 % \end{macrocode}
2188 %
2189 % \begin{macrocode}
2190 \newcounter{atfi@obj}
2191 \renewcommand*{\theatfi@obj}{%
2192 {atfi_obj_\number\c@atfi@obj}%
2193 }
2194 % \end{macrocode}
2195 %
2196 % \paragraph{File embedding}
2197 %
2198 % Most values for Params dictionary found in the \xext{atfi} file
2199 % have priority:
2200 % \begin{itemize}
2201 % \item Recalculation (md5sum, \dots) is avoided.
2202 % \item An external script has more possibilities than programming
2203 % at PostScript level (operating system, getting the date and
2204 % time values of the file with correct interpretation.
2205 % \item Exception: status is called to test file existence, thus
2206 % we get the value of size for free.
2207 % \end{itemize}
2208 % \begin{macrocode}
2209 \define@key{AtFi@file}{Size}{}
2210 % \end{macrocode}
2211 % \begin{macro}{\atfi@embedfile}
2212 % \begin{macrocode}
2213 \def\atfi@embedfile#1{%
2214 \ltx@IfUndefined{atfi@fileobj@#1}{%
2215 \atfi@pdfstringdef\atfi@psfilename{#1}%
2216 \stepcounter{atfi@obj}%
2217 \expandafter\xdef\csname atfi@fileobj@#1\endcsname{\theatfi@obj}%
2218 \begingroup
2219 \let\atfi@params\ltx@empty
2220 \expandafter\let\expandafter\atfi@temp
2221 \csname atfi@file@#1\endcsname
2222 \ifx\atfi@temp\ltx@empty
2223 \let\atfi@temp\relax
2224 \fi
2225 \ifx\atfi@temp\relax
2226 \atfi@pdftexdata{#1}%
2227 \else
2228 \edef\x{%
2229 \noexpand\setkeys{AtFi@file}{\@nameuse{atfi@file@#1}}%
2230 }%
2231 \x
2232 \fi
2233 \atfi@literal{%
2234 /atfi_filename(\atfi@psfilename)def %
2235 atfi_filename status%
2236 {%
2237 % \end{macrocode}
2238 % ok: file found\\
2239 % save parameters of status command
2240 % \begin{macrocode}
2241 /atfi_created exch def%
2242 /atfi_referenced exch def%
2243 /atfi_size exch def %
2244 pop %
2245 % \end{macrocode}
2246 %\begin{verbatim}
2247 %drop parameter "pages" (storage space), never needed
2248 %ghostscript:
2249 % created: stat.st_ctime
2250 % referenced: stat.st_mtime
2251 % stat.st_ctime: interpretion depends on operating system:
2252 % * unix: inode change time (not interesting)
2253 % * win32: probably creation time
2254 % --> /CreationDate
2255 % stat.st_mtime: modification time --> /ModDate
2256 % time values are seconds since 1970-01-01, GMT
2257 %TODO: ghostscript offers "getenv" for getting the value
2258 % of an environment variable. That could be used to
2259 % to detect windows and settingthe /CreationDate entry.
2260 %TODO: how are these values interpreted by other distiller
2261 % programs?
2262 %\end{verbatim}
2263 % \begin{macrocode}
2264 [%
2265 /_objdef \theatfi@obj
2266 /type/stream%
2267 /OBJ pdfmark%
2268 [%
2269 \theatfi@obj
2270 <<%
2271 /Type/EmbeddedFile%
2272 \atfi@mimetype
2273 /Params%
2274 <<%
2275 \atfi@params
2276 %
2277 /Size atfi_size%
2278 %
2279 /product where%
2280 {%
2281 pop %
2282 % \end{macrocode}
2283 % check for ghostscript
2284 % \begin{macrocode}
2285 product (Ghostscript) search%
2286 {%
2287 pop pop pop %
2288 % \end{macrocode}
2289 % ghostscript is running
2290 % \begin{macrocode}
2291 \ifatfi@creationdate
2292 \else
2293 false % TODO: test for windows
2294 {%
2295 /CreationDate atfi_created atfi_convert_date%
2296 } if%
2297 \fi
2298 \ifatfi@moddate
2299 \else
2300 /ModDate atfi_referenced atfi_convert_date%
2301 \fi
2302 } if%
2303 % \end{macrocode}
2304 % look for MD5Encode filter and calculate CheckSum
2305 % \begin{macrocode}
2306 } if %
2307 \ifatfi@checksum
2308 \else
2309 atfi_filename atfi_calc_checksum%
2310 \fi
2311 >>%
2312 >>%
2313 /PUT pdfmark%
2314 [%
2315 \theatfi@obj
2316 atfi_filename (r) file%
2317 /PUT pdfmark%
2318 [%
2319 \theatfi@obj
2320 /CLOSE pdfmark%
2321 }{%
2322 % \end{macrocode}
2323 % error: file not found\\
2324 % currently nothing is done
2325 % \begin{macrocode}
2326 } ifelse%
2327 }%
2328 \endgroup
2329 }{%
2330 % \end{macrocode}
2331 % file already embedded
2332 % \begin{macrocode}
2333 }%
2334 }
2335 % \end{macrocode}
2336 % \end{macro}
2337 %
2338 %
2339 % \paragraph{Annotation appearance}
2340 %
2341 % output: \cs{atfi@appearanceobj}\\
2342 % input: \cs{atfi@appearancebox}, \cs{atfi@icon@icon}
2343 % \begin{macro}{atfi@xfrom@icon}
2344 % \begin{macrocode}
2345 \def\atfi@xform@icon{%
2346 \stepcounter{atfi@obj}%
2347 \edef\atfi@appearanceobj{\theatfi@obj}%
2348 \atfi@literal{%
2349 [%
2350 /_objdef \atfi@appearanceobj
2351 /BBox[%
2352 0 %
2353 0 %
2354 \strip@pt\wd\atfi@appearancebox\space atfi_pttobp %
2355 \strip@pt\dimexpr\dp\atfi@appearancebox
2356 +\ht\atfi@appearancebox\relax\space atfi_pttobp%
2357 ]%
2358 /BP pdfmark %
2359 \csname atfi@acro\atfi@icon@icon @data\endcsname
2360 [%
2361 /EP pdfmark%
2362 }%
2363 }
2364 % \end{macrocode}
2365 % \end{macro}
2366 % \begin{macro}{\atfi@xform}
2367 % output: \cs{atfi@appearanceobj},
2368 % input: \cs{atfi@appearancebox}
2369 % \begin{macrocode}
2370 \def\atfi@xform{%
2371 \stepcounter{atfi@obj}%
2372 \edef\atfi@appearanceobj{\theatfi@obj}%
2373 \begingroup
2374 \setbox\ltx@zero=\hbox{%
2375 \atfi@literal{%
2376 [%
2377 /_objdef \atfi@appearanceobj
2378 /BBox[%
2379 currentpoint %
2380 \strip@pt\dp\atfi@appearancebox\space sub %
2381 currentpoint %
2382 exch \strip@pt\wd\atfi@appearancebox\space add %
2383 exch \strip@pt\ht\atfi@appearancebox\space add%
2384 ]%
2385 /BP pdfmark %
2386 gsave %
2387 currentpoint %
2388 2 copy translate %
2389 72.27 Resolution div 72.27 VResolution div neg scale %
2390 exch neg exch neg translate%
2391 }%
2392 \usebox{\atfi@appearancebox}%
2393 \atfi@literal{%
2394 grestore%
2395 [%
2396 /EP pdfmark%
2397 }%
2398 }%
2399 % do not allocate any space for xobject definition
2400 \dp\ltx@zero=\z@
2401 \ht\ltx@zero=\z@
2402 \wd\ltx@zero=\z@
2403 \mbox{\usebox\ltx@zero}%
2404 \endgroup
2405 }
2406 % \end{macrocode}
2407 % \end{macro}
2408 % \begin{macro}{\atfi@refxform}
2409 % \begin{macrocode}
2410 \def\atfi@refxform#1{%
2411 \raisebox{-\atfi@appearancedepth}{%
2412 \atfi@literal{%
2413 gsave %
2414 currentpoint translate %
2415 Resolution 72 div VResolution neg 72 div scale%
2416 [#1 /SP pdfmark % hash-ok
2417 grestore%
2418 }%
2419 \makebox[\atfi@appearancewidth]{}%
2420 }%
2421 \rule{0pt}{\atfi@appearanceheight}%
2422 }
2423 % \end{macrocode}
2424 % \end{macro}
2425 %
2426 % \paragraph{File attachment annotation}
2427 %
2428 % \begin{macro}{\atfi@insert@file@annot}
2429 % \begin{macrocode}
2430 \def\atfi@insert@file@annot#1{%
2431 \rule{0pt}{0pt}%
2432 \ifatfi@appearance
2433 \def\atfi@appearance@dict{%
2434 /AP<<%
2435 /N \atfi@appearanceobj
2436 /R \atfi@appearanceobj
2437 /D \atfi@appearanceobj
2438 >>%
2439 }%
2440 \else
2441 \let\atfi@appearance@dict\ltx@empty
2442 \fi
2443 \ltx@IfUndefined{atfi@fsobj@#1}{%
2444 \stepcounter{atfi@obj}%
2445 \expandafter
2446 \xdef\csname atfi@fsobj@#1\endcsname{\theatfi@obj}%
2447 \begingroup
2448 \hypersetup{unicode=false}%
2449 \atfi@pdfstringdef\atfi@file{#1}%
2450 \atfi@literal{%
2451 [%
2452 /_objdef \theatfi@obj
2453 /type/dict%
2454 /OBJ pdfmark%
2455 [%
2456 \theatfi@obj
2457 <<%
2458 /Type/Filespec%
2459 /F(\atfi@file)%
2460 \ifx\atfi@ucfilespec\ltx@empty
2461 \else
2462 /UF(\atfi@ucfilespec)%
2463 \fi
2464 /EF<<%
2465 /F \csname atfi@fileobj@#1\endcsname
2466 >>%
2467 >>%
2468 /PUT pdfmark%
2469 }%
2470 \endgroup
2471 }{%
2472 }%
2473 \atfi@literal{%
2474 [%
2475 /Subtype/FileAttachment%
2476 \atfi@icon
2477 \atfi@color@annot
2478 \atfi@author
2479 \atfi@date
2480 \atfi@annotname
2481 \atfi@description
2482 \atfi@subject
2483 \atfi@appearance@dict
2484 /F \theatfi@flags
2485 /FS \csname atfi@fsobj@#1\endcsname
2486 /Rect[%
2487 currentpoint %
2488 \strip@pt\dimexpr\atfi@scale\atfi@appearancedepth\relax
2489 \space atfi_pdftodvipsy add %
2490 currentpoint %
2491 exch %
2492 \strip@pt\dimexpr\atfi@scale\atfi@appearancewidth\relax
2493 \space atfi_pdftodvipsx add %
2494 exch %
2495 \strip@pt\dimexpr\atfi@scale\atfi@appearanceheight\relax
2496 \space atfi_pdftodvipsy sub %
2497 ]%
2498 /ANN pdfmark%
2499 }%
2500 \rule{0pt}{\atfi@appearanceheight}%
2501 \rule[-\atfi@appearancedepth]{0pt}{\atfi@appearancedepth}%
2502 \rule{\atfi@appearancewidth}{0pt}%
2503 }
2504 % \end{macrocode}
2505 % \end{macro}
2506 %
2507 % \begin{macrocode}
2508 %</dvips>
2509 % \end{macrocode}
2510 %
2511 % \subsubsection{dvipdfmx}
2512 %
2513 % \begin{macrocode}
2514 %<*dvipdfmx>
2515 \NeedsTeXFormat{LaTeX2e}
2516 \ProvidesFile{atfi-dvipdfmx.def}%
2517 [2024-01-18 v2.12 attachfile2 driver for dvipdfmx/XeTeX (HO)]%
2518 % \end{macrocode}
2519 %
2520 % \paragraph{Macros for graphics data}
2521 %
2522 % \begin{macro}{\atfi@special}
2523 % \begin{macrocode}
2524 \def\atfi@special#1{%
2525 \special{pdf:#1}%
2526 }
2527 % \end{macrocode}
2528 % \end{macro}
2529 % \begin{macro}{\atfi@literal}
2530 % \begin{macrocode}
2531 \def\atfi@literal#1{%
2532 \atfi@special{content #1}%
2533 }
2534 % \end{macrocode}
2535 % \end{macro}
2536 %
2537 % \begin{macrocode}
2538 \def\atfi@GSAVE{q }
2539 \def\atfi@GRESTORE{Q }
2540 \def\atfi@SETLINEWIDTH{w }
2541 \def\atfi@LINETO{l }
2542 \def\atfi@MOVETO{m }
2543 \def\atfi@STROKE{S }
2544 \def\atfi@FILL{f }
2545 \def\atfi@FILLSTROKE#1#2{#1#2B }
2546 \def\atfi@SETRGBCOLORSTROKE{RG }
2547 \def\atfi@SETRGBCOLORFILL{rg }
2548 \def\atfi@SETGRAYSTROKE{G }
2549 \def\atfi@SETGRAYFILL{g }
2550 \def\atfi@SETCMYKCOLORSTROKE{K }
2551 \def\atfi@SETCMYKCOLORFILL{k }
2552 \def\atfi@RECTFILL{re f }
2553 \def\atfi@RECTSTROKEFILL#1#2#3{#1#2#3re B }
2554 \def\atfi@SETMITERLIMIT{M }
2555 \def\atfi@SETFLAT{i }
2556 \def\atfi@SETLINECAP{J }
2557 \def\atfi@CURVETO{c }
2558 \def\atfi@CURVETOV{v }
2559 \def\atfi@CURVETOY{y }
2560 \def\atfi@CLOSEPATH{h }
2561 \def\atfi@SETLINEJOIN{j }
2562 % \end{macrocode}
2563 %
2564 % \begin{macrocode}
2565 \newcounter{atfi@obj}
2566 \renewcommand*{\theatfi@obj}{%
2567 @atfi_obj_\number\c@atfi@obj
2568 }
2569 % \end{macrocode}
2570 %
2571 % \paragraph{File embedding}
2572 %
2573 % \begin{macrocode}
2574 \define@key{AtFi@file}{Size}{%
2575 \edef\atfi@params{\atfi@params/Size #1}%
2576 }
2577 % \end{macrocode}
2578 % \begin{macro}{\atfi@embedfile}
2579 % \begin{macrocode}
2580 \def\atfi@embedfile#1{%
2581 \ltx@IfUndefined{atfi@fileobj@#1}{%
2582 \stepcounter{atfi@obj}%
2583 \begingroup
2584 \let\atfi@params\ltx@empty
2585 \expandafter\let\expandafter\atfi@temp
2586 \csname atfi@file@#1\endcsname
2587 \ifx\atfi@temp\ltx@empty
2588 \let\atfi@temp\relax
2589 \fi
2590 \ifx\atfi@temp\relax
2591 \atfi@pdftexdata{#1}%
2592 \else
2593 \edef\x{%
2594 \noexpand\setkeys{AtFi@file}{\@nameuse{atfi@file@#1}}%
2595 }%
2596 \x
2597 \fi
2598 \ifx\atfi@params\ltx@empty
2599 \else
2600 \edef\atfi@params{/Params<<\atfi@params>>}%
2601 \fi
2602 \edef\atfi@FILE{#1}%
2603 \filename@parse\atfi@FILE
2604 \ifx\filename@area\ltx@empty
2605 \edef\atfi@FILE{./\atfi@FILE}%
2606 \fi
2607 \EdefEscapeString\atfi@FILE{\atfi@FILE}%
2608 \atfi@special{fstream %
2609 \theatfi@obj
2610 (\atfi@FILE)%
2611 <<%
2612 /Type/EmbeddedFile%
2613 \atfi@mimetype
2614 \atfi@params
2615 >>%
2616 }%
2617 \atfi@special{close \theatfi@obj}%
2618 \expandafter
2619 \xdef\csname atfi@fileobj@#1\endcsname{\theatfi@obj}%
2620 \endgroup
2621 }{%
2622 % file already embedded
2623 }%
2624 }
2625 % \end{macrocode}
2626 % \end{macro}
2627 %
2628 % \paragraph{Annotation appearance}
2629 %
2630 % \begin{macro}{\atfi@xform}
2631 % input: \cs{atfi@appearancebox}, output: \cs{atfi@appearanceobj}
2632 % \begin{macrocode}
2633 \def\atfi@xform{%
2634 \stepcounter{atfi@obj}%
2635 \smash{%
2636 \rlap{%
2637 \atfi@special{bxobj \theatfi@obj\space
2638 width \the\wd\atfi@appearancebox\space
2639 height \the\ht\atfi@appearancebox\space
2640 depth \the\dp\atfi@appearancebox
2641 }%
2642 \usebox\atfi@appearancebox
2643 \atfi@special{exobj}%
2644 }%
2645 }%
2646 \edef\atfi@appearanceobj{\theatfi@obj}%
2647 }
2648 % \end{macrocode}
2649 % \end{macro}
2650 % \begin{macro}{\atfi@xform@icon}
2651 % \begin{macrocode}
2652 \let\atfi@xform@icon\atfi@xform
2653 % \end{macrocode}
2654 % \end{macro}
2655 %
2656 % \begin{macro}{\atfi@refxform}
2657 % \begin{macrocode}
2658 \def\atfi@refxform#1{%
2659 \leavevmode
2660 \atfi@special{uxobj #1}%
2661 }
2662 % \end{macrocode}
2663 % \end{macro}
2664 %
2665 % \paragraph{File attachment annotation}
2666 %
2667 % \begin{macro}{\atfi@insert@file@annot}
2668 % \begin{macrocode}
2669 \def\atfi@insert@file@annot#1{%
2670 \rule{0pt}{0pt}%
2671 \ifatfi@appearance
2672 \def\atfi@appearance@dict{%
2673 /AP<<%
2674 /N \atfi@appearanceobj
2675 /R \atfi@appearanceobj
2676 /D \atfi@appearanceobj
2677 >>%
2678 }%
2679 \else
2680 \let\atfi@appearance@dict\ltx@empty
2681 \fi
2682 \ltx@IfUndefined{atfi@fsobj@#1}{%
2683 \begingroup
2684 \ifxetex
2685 \let\atfi@temp\Hy@Warning
2686 \let\Hy@Warning\ltx@gobble
2687 \fi
2688 \Hy@unicodefalse%
2689 \ifxetex
2690 \let\Hy@Warning\atfi@temp
2691 \fi
2692 \atfi@pdfstringdef\atfi@file{#1}%
2693 \stepcounter{atfi@obj}%
2694 \atfi@special{obj \theatfi@obj <<%
2695 /Type/Filespec%
2696 /F(\atfi@file)%
2697 \ifx\atfi@ucfilespec\ltx@empty
2698 \else
2699 /UF(\atfi@ucfilespec)%
2700 \fi
2701 /EF<<%
2702 /F \@nameuse{atfi@fileobj@#1}%
2703 >>%
2704 >>%
2705 }%
2706 \expandafter\xdef\csname atfi@fsobj@#1\endcsname{%
2707 \theatfi@obj
2708 }%
2709 \endgroup
2710 }{%
2711 }%
2712 \begingroup
2713 \dimen@=\atfi@scale\atfi@appearancewidth
2714 \edef\atfi@rule{width \the\dimen@}%
2715 \dimen@=\atfi@scale\atfi@appearanceheight
2716 \edef\atfi@rule{\atfi@rule\space height \the\dimen@}%
2717 \dimen@=\atfi@scale\atfi@appearancedepth
2718 \edef\atfi@rule{\atfi@rule\space depth \the\dimen@}%
2719 \atfi@special{ann \atfi@rule
2720 <<%
2721 /Subtype/FileAttachment%
2722 \atfi@icon
2723 \atfi@color@annot
2724 \atfi@author
2725 \atfi@date
2726 \atfi@annotname
2727 \atfi@description
2728 \atfi@subject
2729 \atfi@appearance@dict
2730 /F \theatfi@flags
2731 /FS \@nameuse{atfi@fsobj@#1}%
2732 >>%
2733 }%
2734 \endgroup
2735 \rule{0pt}{\atfi@appearanceheight}%
2736 \rule[-\atfi@appearancedepth]{0pt}{\atfi@appearancedepth}%
2737 \rule{\atfi@appearancewidth}{0pt}%
2738 }
2739 % \end{macrocode}
2740 % \end{macro}
2741 %
2742 %
2743 % \begin{macrocode}
2744 %</dvipdfmx>
2745 % \end{macrocode}
2746 %
2747 % \subsection{Perl script \xfile{pdfatfi.pl}}
2748 %
2749 % \begin{macrocode}
2750 %<*pdfatfi>
2751 % \end{macrocode}
2752 % \begingroup\small
2753 % \SpecialEscapechar\|
2754 % \begin{macrocode}
2755 #!/usr/bin/env perl
2756 use strict;
2757 $^W=1; # turn warning on
2758 #
2759 # pdfatfi.pl
2760 #
2761 # Copyright (C) 2005-2010, 2012 Heiko Oberdiek.
2762 #
2763 # This work may be distributed and/or modified under the
2764 # conditions of the LaTeX Project Public License, either
2765 # version 1.3c of this license or (at your option) any later
2766 # version. This version of this license is in
2767 # https://www.latex-project.org/lppl/lppl-1-3c.txt
2768 # and the latest version of this license is in
2769 # https://www.latex-project.org/lppl.txt
2770 # and version 1.3 or later is part of all distributions of
2771 # LaTeX version 2005/12/01 or later.
2772 #
2773 # This work has the LPPL maintenance status "maintained".
2774 #
2775 # The Current Maintainers of this work are
2776 # Heiko Oberdiek and the Oberdiek Package Support Group
2777 # https://github.com/ho-tex/attachfile2/issues
2778 #
2779 # See file "attachfile2.pdf" for a list of files that belong to
2780 # this project.
2781 #
2782 # This file "pdfatfi.pl" may be renamed to "pdfatfi"
2783 # for installation purposes.
2784 #
2785 my $prj = 'pdfatfi';
2786 my $file = "$prj.pl";
2787 my $program = uc($&) if $file =~ /^\w+/;
2788 my $version = "2.9";
2789 my $date = "2019/11/26";
2790 my $author = "Heiko Oberdiek";
2791 my $copyright = "Copyright (c) 2005-2010, 2012 by $author.";
2792 #
2793 # History:
2794 # 2005/05/21 v1.0: First release.
2795 # 2006/08/16 v2.2: Included in DTX file of attachfile2.dtx.
2796 # 2010/09/27 v2.6: Keys ModDateTZ and CreationDateTZ added.
2797 # 2016/05/16 v2.8: Option --version added.
2798 # 2019/11/24 v2.10: adapted version to attachfile2 version.
2799 #
2800
2801 use POSIX qw(strftime); # %z is used (GNU)
2802 use Digest::MD5;
2803
2804 ### program identification
2805 my $title = "$program $version, $date - $copyright\n";
2806
2807 ### error strings
2808 my $Error = "!!! Error:"; # error prefix
2809
2810 ### variables
2811 my $atfifile;
2812
2813 ### option variables
2814 my @bool = ("false", "true");
2815 $::opt_help = 0;
2816 $::opt_quiet = 0;
2817 $::opt_debug = 0;
2818 $::opt_verbose = 0;
2819 $::opt_version = 0;
2820
2821 my $usage = <<"END_OF_USAGE";
2822 ${title}Syntax: \L$program\E [options] <file[.atfi]>
2823 Function: Help program for LaTeX package "attachfile2".
2824 Options: (defaults:)
2825 --help print usage
2826 --version print version number
2827 --(no)quiet suppress messages ($bool[$::opt_quiet])
2828 --(no)verbose verbose printing ($bool[$::opt_verbose])
2829 --(no)debug debug informations ($bool[$::opt_debug])
2830 END_OF_USAGE
2831
2832 ### process options
2833 my @OrgArgv = @ARGV;
2834 use Getopt::Long;
2835 GetOptions(
2836 "help!",
2837 "version!",
2838 "quiet!",
2839 "debug!",
2840 "verbose!",
2841 ) or die $usage;
2842 !$::opt_help or die $usage;
2843 if ($::opt_version) {
2844 print "$prj $date v$version\n";
2845 exit(0);
2846 }
2847 @ARGV == 1 or die "$usage$Error Missing jobname!\n";
2848
2849 $::opt_quiet = 0 if $::opt_verbose;
2850
2851 print $title unless $::opt_quiet;
2852
2853 ### get jobname
2854 $atfifile = $ARGV[0];
2855 if (!-f $atfifile && -f "$atfifile.atfi") {
2856 $atfifile .= ".atfi";
2857 }
2858 -f $atfifile or die "$Error File `$atfifile' not found!\n";
2859
2860 print "* job file = $atfifile\n" if $::opt_verbose;
2861
2862 if ($::opt_debug) {
2863 print <<"END_DEB";
2864 * OSNAME: $^O
2865 * PERL_VERSION: $]
2866 * ARGV: @OrgArgv
2867 END_DEB
2868 }
2869
2870 my $tmpfile = $atfifile . ".tmp";
2871
2872 my $timezone = strftime "%z", localtime;
2873
2874 sub gettz ($) {
2875 my $time = shift;
2876 my $tz = strftime "%z", localtime($time);
2877 return '' unless $tz;
2878 return 'Z' if $tz eq '+0000';
2879 $tz =~ s/^([+\-]\d\d)(\d\d)$/$1'$2'/;
2880 return $tz;
2881 }
2882
2883 open(IN, $atfifile) or die "$Error Cannot open `$atfifile'!\n";
2884 open(OUT, ">$tmpfile") or die "$Error Cannot write `$tmpfile'!\n";
2885
2886 while(<IN>) {
2887 # timezone
2888 if (s/^(\\attachfile\@timezone\{).*(\})$/$1$timezone$2/) {
2889 print "* timezone = $timezone\n" if $::opt_verbose;
2890 }
2891
2892 # file entry
2893 if (/^\\attachfile\@file\[[^\]]*\]\{(.*)\}$/) {
2894 my $hexfile = $1;
2895 my $file = pack('H*', $hexfile);
2896 my @s = stat($file);
2897 if (@s == 0) {
2898 print "!!! Warning: File `$file' not found!\n";
2899 }
2900 else {
2901 my $size = $s[7];
2902 my $mtime = $s[9];
2903 my $ctime = $s[10]; # inode change time
2904
2905 my ($sec, $min, $hour, $mday, $mon, $year) =
2906 localtime($mtime);
2907 my $moddate = sprintf("%04d%02d%02d%02d%02d%02d",
2908 $year + 1900, $mon + 1, $mday,
2909 $hour, $min, $sec);
2910 my $moddatetz = 'D:' . $moddate . gettz($mtime);
2911
2912 # Manual page "perlport" says that "ctime" is creation
2913 # time instead of inode change time for "Win32" and
2914 # "Mac OS", but it is unsupported for "Mac OS X".
2915 my $creationdate = "";
2916 my $creationdatetz = "";
2917 if ($^O eq 'MSWin32') { # cygwin?
2918 ($sec, $min, $hour, $mday, $mon, $year) =
2919 localtime($ctime);
2920 $creationdate = sprintf("%04d%02d%02d%02d%02d%02d",
2921 $year + 1900, $mon + 1, $mday,
2922 $hour, $min, $sec);
2923 $creationdatetz =
2924 'D:' . $creationdate . gettz($ctime);
2925 }
2926
2927 # md5 checksum
2928 my $checksum = "";
2929 my $ctx = Digest::MD5->new;
2930 if (open(FILE, $file)) {
2931 $ctx->addfile(*FILE);
2932 $checksum = $ctx->hexdigest;
2933 close(FILE);
2934 }
2935 else {
2936 print "!!! Warning: File `$file' cannot be read,"
2937 . " dropping checksum!\n";
2938 }
2939
2940 $_ = "\\attachfile\@file["
2941 . "ModDateTZ=$moddatetz"
2942 . ",Size=$size"
2943 . ($checksum ? ",CheckSum=$checksum" : "")
2944 . ($creationdatetz ?
2945 ",CreationDateTZ=$creationdatetz" :
2946 ($creationdate ?
2947 ",CreationDate=$creationdate" : ""))
2948 . "]{$hexfile}\n";
2949 if ($::opt_verbose) {
2950 print "* file entry = $file\n";
2951 print " size = $size\n";
2952 print " moddate = $moddate\n";
2953 print " creationdate = $creationdate\n"
2954 if $creationdate;
2955 print " checksum = $checksum\n" if $checksum;
2956 }
2957 }
2958 }
2959
2960 print OUT $_;
2961 }
2962
2963 close(IN);
2964 close(OUT);
2965
2966 unlink($atfifile) or die "$Error Cannot delete old `$atfifile'!\n";
2967 rename $tmpfile, $atfifile
2968 or die "$Error Cannot move `$tmpfile' to `$atfifile'!\n";
2969
2970 print "*** ready. ***\n" unless $::opt_quiet;
2971
2972 __END__
2973 % \end{macrocode}
2974 % \endgroup
2975 % \begin{macrocode}
2976 %</pdfatfi>
2977 % \end{macrocode}
2978 %
2979 % \begin{macrocode}
2980 %<*pdfatfiman>
2981 .TH pdfatfi 1 "2019-11-24"
2982 .SH NAME
2983 pdfatfi \- Help program for the LaTeX package attachfile2.
2984 .SH SYNOPSIS
2985 pdfatfi <command> [<options>] <file[.atfi]>]
2986 .SH DESCRIPTION
2987 Helper program for the LaTeX package attachfile2.
2988
2989 This package also tries to get and add meta information data,
2990 such as file size, file date, checksum, ....
2991
2992 The script pdfatfi.pl is provided for use with old versions of
2993 pdfTeX and XeTeX that do not provide access
2994 to file metadata.
2995
2996 The use of the Perl script is not mandatory. This data can be shown
2997 by PDF viewers, but they are not a requirement of the PDF specification.
2998
2999 Package attachfile2 and the Perl script communicate
3000 via an auxiliary file with file extension .atfi. The script
3001 is used between two LaTeX runs and updates the auxiliary file.
3002
3003 .nf
3004 latex test
3005 pdfatfi test
3006 latex test
3007 dvips test
3008 ps2pdf test.ps test.pdf
3009 .fi
3010
3011 .SH OPTIONS
3012 Various options are supported
3013 .IP --help
3014 Show help text.
3015 .IP --version
3016 Print version number
3017 .IP --(no)quiet
3018 Suppress/don't suppress messages
3019 .IP --(no)verbose
3020 Verbose (not verbose) printing.
3021 .IP --(no)debug
3022 Debug infomation printed (not printed)
3023 .SH BUGS
3024 Please log issues on the GitHub homepage:
3025 .br
3026 https://github.com/ho-tex/attachfile2/issues.
3027 .SH AUTHOR
3028 Heiko Oberdiek ([email protected])
3029 .SH SEE ALSO
3030 See attachfile2.pdf for more details.
3031 %</pdfatfiman>
3032 % \end{macrocode}
3033 %
3034 % \section{Installation}
3035 %
3036 % \subsection{Download}
3037 %
3038 % \paragraph{Package.} This package is available on
3039 % CTAN\footnote{\CTANpkg{attachfile2}}:
3040 % \begin{description}
3041 % \item[\CTAN{macros/latex/contrib/attachfile2/attachfile2.dtx}] The source file.
3042 % \item[\CTAN{macros/latex/contrib/attachfile2/attachfile2.pdf}] Documentation.
3043 % \end{description}
3044 %
3045 %
3046 % \paragraph{Bundle.} All the packages of the bundle `attachfile2'
3047 % are also available in a TDS compliant ZIP archive. There
3048 % the packages are already unpacked and the documentation files
3049 % are generated. The files and directories obey the TDS standard.
3050 % \begin{description}
3051 % \item[\CTANinstall{install/macros/latex/contrib/attachfile2.tds.zip}]
3052 % \end{description}
3053 % \emph{TDS} refers to the standard ``A Directory Structure
3054 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
3055 % with \xfile{texmf} in their name are usually organized this way.
3056 %
3057 % \subsection{Bundle installation}
3058 %
3059 % \paragraph{Unpacking.} Unpack the \xfile{attachfile2.tds.zip} in the
3060 % TDS tree (also known as \xfile{texmf} tree) of your choice.
3061 % Example (linux):
3062 % \begin{quote}
3063 % |unzip attachfile2.tds.zip -d ~/texmf|
3064 % \end{quote}
3065 %
3066 % \paragraph{Script installation.}
3067 % Check the directory \xfile{TDS:scripts/attachfile2/} for
3068 % scripts that need further installation steps.
3069 % Package \xpackage{attachfile2} comes with the Perl script
3070 % \xfile{pdfatfi.pl} that should be installed in such a way
3071 % that it can be called as \texttt{pdfatfi}.
3072 % Example (linux):
3073 % \begin{quote}
3074 % |chmod +x scripts/attachfile2/pdfatfi.pl|\\
3075 % |cp scripts/attachfile2/pdfatfi.pl /usr/local/bin/|
3076 % \end{quote}
3077 %
3078 % \subsection{Package installation}
3079 %
3080 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
3081 % \docstrip\ archive. The files are extracted by running the
3082 % \xfile{.dtx} through \plainTeX:
3083 % \begin{quote}
3084 % \verb|tex attachfile2.dtx|
3085 % \end{quote}
3086 %
3087 % \paragraph{TDS.} Now the different files must be moved into
3088 % the different directories in your installation TDS tree
3089 % (also known as \xfile{texmf} tree):
3090 % \begin{quote}
3091 % \def\t{^^A
3092 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
3093 % attachfile2.sty & tex/latex/attachfile2/attachfile2.sty\\
3094 % atfi-dvips.def & tex/latex/attachfile2/atfi-dvips.def\\
3095 % atfi-pdftex.def & tex/latex/attachfile2/atfi-pdftex.def\\
3096 % atfi-dvipdfmx.def & tex/latex/attachfile2/atfi-dvipdfmx.def\\
3097 % pdfatfi.pl & scripts/attachfile2/pdfatfi.pl\\
3098 % attachfile2.pdf & doc/latex/attachfile2/attachfile2.pdf\\
3099 % attachfile2.dtx & source/latex/attachfile2/attachfile2.dtx\\
3100 % \end{tabular}^^A
3101 % }^^A
3102 % \sbox0{\t}^^A
3103 % \ifdim\wd0>\linewidth
3104 % \begingroup
3105 % \advance\linewidth by\leftmargin
3106 % \advance\linewidth by\rightmargin
3107 % \edef\x{\endgroup
3108 % \def\noexpand\lw{\the\linewidth}^^A
3109 % }\x
3110 % \def\lwbox{^^A
3111 % \leavevmode
3112 % \hbox to \linewidth{^^A
3113 % \kern-\leftmargin\relax
3114 % \hss
3115 % \usebox0
3116 % \hss
3117 % \kern-\rightmargin\relax
3118 % }^^A
3119 % }^^A
3120 % \ifdim\wd0>\lw
3121 % \sbox0{\small\t}^^A
3122 % \ifdim\wd0>\linewidth
3123 % \ifdim\wd0>\lw
3124 % \sbox0{\footnotesize\t}^^A
3125 % \ifdim\wd0>\linewidth
3126 % \ifdim\wd0>\lw
3127 % \sbox0{\scriptsize\t}^^A
3128 % \ifdim\wd0>\linewidth
3129 % \ifdim\wd0>\lw
3130 % \sbox0{\tiny\t}^^A
3131 % \ifdim\wd0>\linewidth
3132 % \lwbox
3133 % \else
3134 % \usebox0
3135 % \fi
3136 % \else
3137 % \lwbox
3138 % \fi
3139 % \else
3140 % \usebox0
3141 % \fi
3142 % \else
3143 % \lwbox
3144 % \fi
3145 % \else
3146 % \usebox0
3147 % \fi
3148 % \else
3149 % \lwbox
3150 % \fi
3151 % \else
3152 % \usebox0
3153 % \fi
3154 % \else
3155 % \lwbox
3156 % \fi
3157 % \else
3158 % \usebox0
3159 % \fi
3160 % \end{quote}
3161 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
3162 % TDS installing feature, then some files can already be in the right
3163 % place, see the documentation of \docstrip.
3164 %
3165 % \subsection{Refresh file name databases}
3166 %
3167 % If your \TeX~distribution
3168 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
3169 % these. For example, \TeX\,Live\ users run \verb|texhash| or
3170 % \verb|mktexlsr|.
3171 %
3172 % \subsection{Script installation}
3173 % This package comes with a Perl script \xfile{pdfatfi.pl}.
3174 % Install it somewhere so that it is executed, when it is called
3175 % as \verb|pdfatfi| on the command line. Example for
3176 % installing it under Linux:
3177 % \begin{quote}
3178 %\begin{verbatim}
3179 %cp pdfatfi.pl /usr/local/bin/pdfatfi
3180 %chmod +x /usr/local/bin/pdfatfi
3181 %\end{verbatim}
3182 % \end{quote}
3183 %
3184 %
3185 % \subsection{Some details for the interested}
3186 %
3187 % \paragraph{Unpacking with \LaTeX.}
3188 % The \xfile{.dtx} chooses its action depending on the format:
3189 % \begin{description}
3190 % \item[\plainTeX:] Run \docstrip\ and extract the files.
3191 % \item[\LaTeX:] Generate the documentation.
3192 % \end{description}
3193 % If you insist on using \LaTeX\ for \docstrip\ (really,
3194 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
3195 % about your intention:
3196 % \begin{quote}
3197 % \verb|latex \let\install=y\input{attachfile2.dtx}|
3198 % \end{quote}
3199 % Do not forget to quote the argument according to the demands
3200 % of your shell.
3201 %
3202 % \paragraph{Generating the documentation.}
3203 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
3204 % the documentation. The process can be configured by the
3205 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
3206 % line into this file, if you want to have A4 as paper format:
3207 % \begin{quote}
3208 % \verb|\PassOptionsToClass{a4paper}{article}|
3209 % \end{quote}
3210 % An example follows how to generate the
3211 % documentation with pdf\LaTeX:
3212 % \begin{quote}
3213 %\begin{verbatim}
3214 %pdflatex attachfile2.dtx
3215 %makeindex -s gind.ist attachfile2.idx
3216 %pdflatex attachfile2.dtx
3217 %makeindex -s gind.ist attachfile2.idx
3218 %pdflatex attachfile2.dtx
3219 %\end{verbatim}
3220 % \end{quote}
3221 %
3222 % \begin{thebibliography}{9}
3223 % \bibitem{attachfile}
3224 % Scott Pakin: \textit{The \xpackage{attachfile} package};
3225 % 2005/02/20 v1.2;
3226 % \CTANpkg{attachfile}.
3227 %
3228 % \bibitem{embedfile}
3229 % Heiko Oberdiek: \textit{The \xpackage{embedfile} package};
3230 % 2006/08/16 v1.0;
3231 % \CTANpkg{embedfile}.
3232 %
3233 % \bibitem{pdfspec}
3234 % Adobe Systems Incorporated:
3235 % \href{https://www.adobe.com/devnet/pdf/pdf_reference.html}%
3236 % {\textit{PDF Reference, Version 1.7}},%
3237 %
3238 % \bibitem{mime}
3239 % Network Working Group: RFC 2046, \textit{Multipurpose Internet Mail Extensions (MIME) Part Two:
3240 % Media Types}, November 1996; \url{http://www.rfc-editor.org/}.
3241 %
3242 % \bibitem{types}
3243 % IANA (Internet Assigned Numbers Authority):
3244 % \textit{MIME Media Types}, May 2006;
3245 % \url{http://www.iana.org/assignments/media-types/}.
3246 %
3247 % \end{thebibliography}
3248 %
3249 % \begin{History}
3250 % \begin{Version}{2005/02/23 v2.0}
3251 % \item
3252 % New options: \xoption{draft}/\xoption{final}.
3253 % \item
3254 % New option scale for scaling the annotation rectangle.
3255 % \item
3256 % Supported driver options: \xoption{pdftex}, \xoption{dvips}.
3257 % \item
3258 % Configuration file `attachfile.cfg' supported.
3259 % \item
3260 % Dependency of package calc dropped.
3261 % \item
3262 % \eTeX\ (\cs{numexpr}, \cs{dimexpr}) used.
3263 % \item
3264 % New auxiliary file \cs{jobname.atfi} to get data unavailable
3265 % by (pdf)\TeX, controlled by \cs{nofiles} and option nofiles.
3266 % \item
3267 % Use of package \xpackage{prokvopt} (never released).
3268 % \end{Version}
3269 % \begin{Version}{2005/10/07 v2.1}
3270 % \item
3271 % Option \xoption{annotname} for naming annotations
3272 % (this name can be used for embedded go-to actions).
3273 % \end{Version}
3274 % \begin{Version}{2006/08/17 v2.2}
3275 % \item
3276 % Use of package \xpackage{kvoptions} instead of \xpackage{prokvopt}.
3277 % \item
3278 % DTX framework.
3279 % \item
3280 % A little documentation.
3281 % \end{Version}
3282 % \begin{Version}{2007/04/11 v2.3}
3283 % \item
3284 % Line ends sanitized.
3285 % \end{Version}
3286 % \begin{Version}{2008/07/29 v2.4}
3287 % \item
3288 % Improved color support. Option \xoption{color} now understands
3289 % the usual color specifications if package \xpackage{xcolor} is
3290 % loaded.
3291 % \end{Version}
3292 % \begin{Version}{2009/09/25 v2.5}
3293 % \item
3294 % New option \xoption{ucfilespec} (since PDF 1.7).
3295 % \item
3296 % Fix: \xpackage{hyperref}'s option \xoption{unicode} is disabled
3297 % for file names except for \xoption{ucfilespec}.
3298 % \end{Version}
3299 % \begin{Version}{2010/09/27 v2.6}
3300 % \item
3301 % Support for dvipdfmx added, new option \xoption{dvipdfmx}
3302 % and alias option \xoption{xetex}.
3303 % (Thanks Will Robertson for pointing to |\special{pdf:fstream ...}|).
3304 % \item
3305 % New option \xoption{driverfallback}.
3306 % \item
3307 % All options except driver options are local options,
3308 % that means they are ignored as global options.
3309 % \item
3310 % Some options are disabled after they are used
3311 % (driver options, \xoption{draft}, \xoption{final}, \xoption{nofiles}).
3312 % \item
3313 % Driver files renamed from \texttt{atfi<driver>.def} to
3314 % \texttt{atfi-<driver>.def}.
3315 % \item
3316 % Bug fix: \cs{textattachfile} now adds an entry into
3317 % the \xext{atfi} file.
3318 % \item
3319 % Program \xfile{pdfatfi.pl} sets modification and creation time with
3320 % time zone, because the time zone offset might differ with
3321 % the file date.
3322 % \end{Version}
3323 % \begin{Version}{2012/04/18 v2.7}
3324 % \item
3325 % Program \xfile{pdfatfi.pl}: Option \xoption{version} added.
3326 % \end{Version}
3327 % \begin{Version}{2016/05/16 v2.8}
3328 % \item
3329 % Documentation updates.
3330 % \end{Version}
3331 % \begin{Version}{2019/07/24 v2.9}
3332 % \item
3333 % Added luatex driver (UF, issue 69)
3334 % \end{Version}
3335 % \begin{Version}{2019/11/24 v2.10}
3336 % \item
3337 % Fix perl header comment
3338 % \item
3339 % Address perl warning \verb|Scalar value @s[7] better written as $s[7] at pdfatfi.pl line 147|
3340 % \item
3341 % use \CTANpkg{iftex} not \CTANpkg{ifpdf}, \CTANpkg{ifxetex}, \CTANpkg{ifluatex}.
3342 % \end{Version}
3343 % \begin{Version}{2019/11/26 v2.11}
3344 % \item
3345 % Add man file for \verb|pdfatfi|.
3346 % \end{Version}
3347 % \begin{Version}{2024-01-18 v2.12}
3348 % \item Doc corrected for issue 7
3349 % \end{Version}
3350 % \end{History}
3351 %
3352 % \PrintIndex
3353 %
3354 % \Finale
3355 \endinput