| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: l3pdffile.dtx |
| 4 |
% |
| 5 |
% Copyright (C) 2018-2026 The LaTeX Project |
| 6 |
% |
| 7 |
% It may be distributed and/or modified under the conditions of the |
| 8 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 9 |
% license or (at your option) any later version. The latest version |
| 10 |
% of this license is in the file |
| 11 |
% |
| 12 |
% http://www.latex-project.org/lppl.txt |
| 13 |
% |
| 14 |
% This file is part of the "LaTeX PDF management bundle" (The Work in LPPL) |
| 15 |
% and all files in that bundle must be distributed together. |
| 16 |
% |
| 17 |
% ----------------------------------------------------------------------- |
| 18 |
% |
| 19 |
% The development version of the package can be found at |
| 20 |
% |
| 21 |
% https://github.com/latex3/pdfresources |
| 22 |
% |
| 23 |
% for those people who are interested. |
| 24 |
% |
| 25 |
%<*driver> |
| 26 |
\DocumentMetadata{tagging=on,pdfstandard=ua-2} |
| 27 |
\documentclass[full]{l3doc} |
| 28 |
\usepackage{latex-lab-testphase-l3doc} |
| 29 |
|
| 30 |
\usepackage{array,booktabs} |
| 31 |
\hypersetup{pdfauthor=The LaTeX Project,pdftitle=l3pdffile (LaTeX PDF management bundle)} |
| 32 |
|
| 33 |
\providecommand\potentialclash{\noindent\llap{\dbend\ }} |
| 34 |
\pdfextension glyphtounicode {char7f}{2621} %for the dbend |
| 35 |
\begin{document} |
| 36 |
\DocInput{\jobname.dtx} |
| 37 |
\end{document} |
| 38 |
%</driver> |
| 39 |
% \fi |
| 40 |
% |
| 41 |
% \title{^^A |
| 42 |
% The \pkg{l3pdffile} module\\ Embedding and referencing files in a PDF ^^A |
| 43 |
% \\ \LaTeX{} PDF management bundle |
| 44 |
% } |
| 45 |
% |
| 46 |
% \author{^^A |
| 47 |
% The \LaTeX{} Project\thanks |
| 48 |
% {^^A |
| 49 |
% E-mail: |
| 50 |
% \href{mailto:[email protected]} |
| 51 |
% {[email protected]}^^A |
| 52 |
% }^^A |
| 53 |
% } |
| 54 |
% |
| 55 |
% \date{Version 0.97c, released 2026-05-26} |
| 56 |
% |
| 57 |
% \maketitle |
| 58 |
% \begin{documentation} |
| 59 |
% |
| 60 |
% \section{\pkg{l3pdffile} documentation} |
| 61 |
% \subsection{Introduction} |
| 62 |
% \subsubsection{Background} |
| 63 |
% External files can be referenced from a PDF in three ways: |
| 64 |
% \begin{enumerate} |
| 65 |
% \item through an annotation of type Link, |
| 66 |
% \item by referencing a local file in the file system, |
| 67 |
% \item by embedding the file directly into the PDF |
| 68 |
% \end{enumerate} |
| 69 |
% Case 1 (Links) are created with the \cs{pdfannot} commands. |
| 70 |
% This module handles the two other cases. Actually from the view |
| 71 |
% of the PDF format they are quite similar: Case 2 is case 3 without the stream |
| 72 |
% object and without the /EF entry in the /Filespec dictionary (this points to the |
| 73 |
% stream object of the file). Not embedding the file makes the PDF smaller. But it is |
| 74 |
% also less portable: the files can only be found if they are in the right location |
| 75 |
% relative to the PDF. The normal case is to embed the file. |
| 76 |
% |
| 77 |
% The tasks to embed and reference such a file are |
| 78 |
% \begin{enumerate} |
| 79 |
% \item Embed the file in a stream. |
| 80 |
% \item Create a Filespec dictionary which references the stream object in the /EF |
| 81 |
% dictionary: |
| 82 |
% \begin{verbatim} |
| 83 |
% << |
| 84 |
% /Type /Filespec |
| 85 |
% /F (l3pdffile.dtx) |
| 86 |
% /UF (l3pdffile.dtx) |
| 87 |
% /AFRelationship /Source |
| 88 |
% /EF <</F 21 0 R /UF 21 0 R>> %case 3, embedded file |
| 89 |
% >> |
| 90 |
% \end{verbatim} |
| 91 |
% The file names in the /UF and /F value don't need to be identical to the |
| 92 |
% name of file on the disc. It is quite possible to embed a \texttt{zzz.tex} |
| 93 |
% and name it \texttt{blub.tex}. The second name is then what the user will see |
| 94 |
% in the attachment list or in the properties of an annotation. |
| 95 |
% |
| 96 |
%\item Reference the Filespec dictionary so that the user can access the file. |
| 97 |
% This can be done in various way: |
| 98 |
% \begin{enumerate} |
| 99 |
% \item With an annotation (/Subtype/FileAttachment). This is done by |
| 100 |
% \pkg{attachfile}, \pkg{attachfile2} and \pkg{intopdf}. |
| 101 |
% Typical entries of such an annotation are: |
| 102 |
% |
| 103 |
% \medskip |
| 104 |
% \begin{tabular}{lll} |
| 105 |
% key & value type & notes\\\hline |
| 106 |
% /FS & object reference &(Filespec dictionary)\\ |
| 107 |
% /Name & name & /Graph, /PushPin, /Paperclip, /Tag\\ |
| 108 |
% /Contents & text string & optional but recommended\\ |
| 109 |
% /F & integer & Flags\\ |
| 110 |
% /AP & dictionary & Appearance (required if rectangle >0) \\ |
| 111 |
% /AS & name\\ |
| 112 |
% \end{tabular} |
| 113 |
% |
| 114 |
% The |/AP| takes precedence over Border and similar keys. |
| 115 |
% \item Through an entry in the |/EmbeddedFiles| name tree. |
| 116 |
% This is what \pkg{embedfiles} does. |
| 117 |
% \begin{verbatim} |
| 118 |
% 20 0 obj %Document Name tree |
| 119 |
% <</EmbeddedFiles 21 0 R>> |
| 120 |
% endobj |
| 121 |
% 21 0 obj %Embedded Files Name dictionary |
| 122 |
% <</Names [(AcmeCustomCrypto Protected PDF.pdf) 17 0 R]>> |
| 123 |
% endobj |
| 124 |
% \end{verbatim} |
| 125 |
% The strings (keys) in the |/Names| dictionary must be sorted lexically. |
| 126 |
% But they don't have to be the file name or anything related to |
| 127 |
% the file name. The resource management code uses l3ef0001, l3ef0002~\ldots, |
| 128 |
% which allows up to 9999 files. |
| 129 |
% The key can be needed to identify the start file in a collection, |
| 130 |
% so their relation to the files are stored in a property list. |
| 131 |
% |
| 132 |
% \item Through the |/AF| key in various objects (pdf 2.0). |
| 133 |
% The value is normally an array of object |
| 134 |
% references, but it can also be a name which is mapped to an array in /Properties: |
| 135 |
% \begin{verbatim} |
| 136 |
% /AF /NamedAF BDC |
| 137 |
% /Properties <</NamedAF [12 0 R] |
| 138 |
% \end{verbatim} |
| 139 |
% The related |/Filespec| dictionary should contain an |
| 140 |
% |/AFRelationship| key in this case (but it doesn't harm to add it by |
| 141 |
% default anyway). The values of this key is describe in table~\ref{tab:AFrel}. |
| 142 |
% |
| 143 |
% \begin{table} |
| 144 |
% \caption{Values of the \texttt{/AFRelationship} key\label{tab:AFrel}} |
| 145 |
% \begin{tabular}{lp{8cm}} |
| 146 |
% Source & shall be used if this file specification is the original |
| 147 |
% source material for the associated content.\\ |
| 148 |
% Data & shall be used if this file specification represents |
| 149 |
% information used to |
| 150 |
% derive a visual presentation – such as for a table or a graph.\\ |
| 151 |
% Alternative & shall be used if this file specification is an |
| 152 |
% alternative representation of content, for example audio.\\ |
| 153 |
% Supplement & shall be used if this file specification represents |
| 154 |
% a supplemental representation of the original source or data |
| 155 |
% that may be more easily consumable |
| 156 |
% (e.g., A MathML version of an equation).\\ |
| 157 |
% EncryptedPayload & shall be used if this file specification |
| 158 |
% is an encrypted payload document that should be displayed to the user |
| 159 |
% if the PDF processor has the cryptographic filter |
| 160 |
% needed to decrypt the document.\\ |
| 161 |
% FormData & shall be used if this file specification |
| 162 |
% is the data associated with the AcroForm |
| 163 |
% (see 12.7.3, \enquote{Interactive form dictionary}) of this PDF.\\ |
| 164 |
% Schema & shall be used if this file specification is a schema |
| 165 |
% definition for the associated object |
| 166 |
% (e.g. an XML schema associated with a metadata stream).\\ |
| 167 |
% Unspecified &(default value) shall be used when the |
| 168 |
% relationship is not known |
| 169 |
% or cannot be described using one of the other values.\\ |
| 170 |
% Other names & Second-class names (see Annex E, |
| 171 |
% \enquote{(normative) PDF Name Registry}) should be used to |
| 172 |
% represent other types of relationships. |
| 173 |
% \end{tabular} |
| 174 |
% \end{table} |
| 175 |
% \end{enumerate} |
| 176 |
% \end{enumerate} |
| 177 |
% |
| 178 |
% \subsubsection{Task 1: Embedding a file} |
| 179 |
% Embedding an existing file is in most cases quite straightforward. This module |
| 180 |
% offers commands, but it can also be done with the basic commands |
| 181 |
% from the |l3pdf| module \cs{pdf_object_unnamed_write:nn} or |
| 182 |
% \cs{pdf_object_new:n}/\cs{pdf_object_write:nnn} or primitive commands |
| 183 |
% to create objects. |
| 184 |
% The object number should be stored for the reference |
| 185 |
% in the |/Filespec| dictionary. |
| 186 |
% |
| 187 |
% \begin{verbatim} |
| 188 |
% \pdf_object_unnamed_write:ne {fstream} |
| 189 |
% { |
| 190 |
% { |
| 191 |
% /Type /EmbeddedFile |
| 192 |
% /Subtype /application\c_hash_str2Fpostscript |
| 193 |
% /Params |
| 194 |
% << |
| 195 |
% /ModDate ~ (\file_timestamp:n{example-image.eps}) |
| 196 |
% /Size ~ \file_size:n {example-image.eps} |
| 197 |
% /CheckSum ~ <\file_mdfive_hash:n {example-image.eps}> |
| 198 |
% >> |
| 199 |
% } |
| 200 |
% {example-image.eps} |
| 201 |
% } |
| 202 |
% \tl_set:Ne \l_my_fileobj_tl {\pdf_object_ref_last:} |
| 203 |
% \end{verbatim} |
| 204 |
% |
| 205 |
% \begin{itemize} |
| 206 |
% \item The |/Params| dictionary is not always required, but the commands of |
| 207 |
% these module will prefill them as shown in the examples. A |/CreationDate| entry |
| 208 |
% has to be added explicitly as there is no sensible way |
| 209 |
% to retrieve this automatically. |
| 210 |
% \item The mimetype (in the |/Subtype|) should be properly escaped. |
| 211 |
% So for example |
| 212 |
% \begin{verbatim} |
| 213 |
% \pdfdict_put:nne{l_pdffile}{Subtype}{/application\string#2Fx-tex} |
| 214 |
% \end{verbatim} |
| 215 |
% But while it is possible to set the subtype like this, it is normally better |
| 216 |
% to rely on the file extension and to let the code autodetect the subtype. |
| 217 |
% This module contains a property list with maps a number of file extensions |
| 218 |
% to mimetypes and the commands try to detect and fill the mimetype automatically. |
| 219 |
% \item The dictionary can contain additional keys (|/Filter|, |/DecodeParms|), |
| 220 |
% see the pdf reference. |
| 221 |
% \end{itemize} |
| 222 |
% |
| 223 |
% \subsubsection{Task 2: Creating the \texttt{/Filespec} dictionary} |
| 224 |
% The |/Filespec| dictionary is a simple dictionary object, and can also |
| 225 |
% be created in various ways. If it refers to an embedded file it should |
| 226 |
% reference it in the |/EF| key. |
| 227 |
% |
| 228 |
% \subsubsection{Task 3: Referencing the \texttt{/Filespec} dictionary} |
| 229 |
% |
| 230 |
% Using the dictionary reference in annotations and |/AF| keys is unproblematic. |
| 231 |
% |
| 232 |
% \potentialclash |
| 233 |
% But to add it to the |/EmbeddedFiles| name tree so that it appears in the |
| 234 |
% attachment panel requires special care: |
| 235 |
% This name tree is a global resource and uncoordinated access can lead to |
| 236 |
% clashes and files that are not visible or inaccessible. |
| 237 |
% The access here is managed by the \pkg{l3pdfmanagement} module:\\[\smallskipamount]% |
| 238 |
% |\pdfmanagement_add:nne{Catalog/Names}{EmbeddedFiles}{|\meta{objref}|}| |
| 239 |
% |
| 240 |
% \subsection{Commands and tools of these module} |
| 241 |
% \begin{function}{file, file/Params, file/streamParams,file/Filespec} |
| 242 |
% The module predefines and uses a number of local dictionaries for the |
| 243 |
% components of the stream and the |/Filespec| object. These dictionaries are |
| 244 |
% then used by the \cs{pdffile_embed_XX}. |
| 245 |
% The content of these dictionaries can be changed by users with the commands |
| 246 |
% from the \pkg{l3pdfdict} module, but it should be done only locally |
| 247 |
% to avoid side effects on uses by other packages/commands. |
| 248 |
|
| 249 |
% The preset values are of these dictionaries are shown in table~\ref{tab:filedict}. |
| 250 |
% \end{function} |
| 251 |
% \begin{table} |
| 252 |
% \caption{Preset values in the file dictionaries\label{tab:filedict}} |
| 253 |
% \hspace*{-3cm}\begin{tabular}{lll} |
| 254 |
% dictionary & key & value \\\hline |
| 255 |
% l\_pdffile & Type & /EmbeddedFile\\ |
| 256 |
% l\_pdffile/Params& Size & |\file_size:n{\l_pdffile_source_name_str}|\\ |
| 257 |
% l\_pdffile/Params& ModDate & |(\file_timestamp:n {\l_pdffile_source_name_str})|\\ |
| 258 |
% l\_pdffile/Params& CheckSum & |<\file_mdfive_hash:n{\l_pdffile_source_name_str}>|\\ |
| 259 |
% l\_pdffile/streamParams& & a /ModDate entry with year/month/date \\ |
| 260 |
% & & (used with \cs{pdffile_embed_stream:nnn})\\ |
| 261 |
% l\_pdffile/Filespec & Type & /Filespec\\ |
| 262 |
% l\_pdffile/Filespec & AFRelationship &Unspecified |
| 263 |
% \end{tabular} |
| 264 |
% \end{table} |
| 265 |
% \begin{function}{\pdffile_embed_file:nnn} |
| 266 |
% \begin{syntax} |
| 267 |
% \cs{pdffile_embed_file:nnn} \Arg{source filename} \Arg{target filename} \Arg{object name} |
| 268 |
% \end{syntax} |
| 269 |
% This commands embeds the file \meta{source filename} in the PDF, |
| 270 |
% and creates a |/Filespec| dictionary object named \meta{object name}. |
| 271 |
% The object name must be unique, it should start with the module name, so |
| 272 |
% e.g. \texttt{module/name}. |
| 273 |
% The command uses the content of the local |
| 274 |
% dictionaries |l_pdffile|, |l_pdffile/Params| and |l_pdffile/Filespec| |
| 275 |
% to setup the dictionary entries of the stream object and the |
| 276 |
% |/Filespec| dictionary. The |/F| and |/UF| entry are filled |
| 277 |
% with \meta{target filename}. |
| 278 |
% |
| 279 |
% It is an error if both \meta{target filename} and \meta{source filename} |
| 280 |
% are empty. |
| 281 |
% |
| 282 |
% If \meta{target filename} is empty \meta{source filename} is used instead. |
| 283 |
% |
| 284 |
% If \meta{source filename} is empty, only a |/Filespec| dictionary is |
| 285 |
% created. |
| 286 |
% |
| 287 |
% If the |l_pdffile| dictionary doesn't contain a |
| 288 |
% Subtype entry with the mimetype, the command tries to guess it |
| 289 |
% from the file extension of \meta{source filename}. Unknown file extensions can be |
| 290 |
% added (or known extension be changed) by adding to or changing the value in |
| 291 |
% the property \cs{g_pdffile_mimetypes_prop}, see below. |
| 292 |
% |
| 293 |
% When using \texttt{dvips} and \texttt{pstopdf} the actual embedding is |
| 294 |
% done by \texttt{pstopdf}. \texttt{pstopdf} will embed files |
| 295 |
% only if used with the option \texttt{-dNOSAFER} and will not be able |
| 296 |
% to use files which are found with \texttt{kpathsea}. |
| 297 |
% |
| 298 |
% \meta{target filename} doesn't need to be a file name with an extension, |
| 299 |
% but it is recommended as security settings in the pdf |
| 300 |
% viewer can restrict access to known file types. |
| 301 |
% \end{function} |
| 302 |
% |
| 303 |
% \begin{NOTE}{UF} |
| 304 |
% we should perhaps also consider the chunk method see pdfbase and |
| 305 |
% https://chat.stackexchange.com/transcript/message/54181193#54181193 |
| 306 |
% \end{NOTE} |
| 307 |
% |
| 308 |
% \begin{function}{\pdffile_embed_stream:nnn,\pdffile_embed_stream:nnN} |
| 309 |
% \begin{syntax} |
| 310 |
% \cs{pdffile_embed_stream:nnn} \Arg{content} \Arg{target filename} \Arg{object name}\\ |
| 311 |
% \cs{pdffile_embed_stream:nnN} \Arg{content} \Arg{target filename} \meta{tl var} |
| 312 |
% \end{syntax} |
| 313 |
% This commands embeds the \meta{content} in the PDF in a stream objects and |
| 314 |
% creates either a |/Filespec| dictionary object named \meta{object name}, or stores |
| 315 |
% the object reference (what you would get with \cs{pdf_object_ref:n}) in \meta{tl var}. |
| 316 |
% \meta{content} is wrapped in a \cs{exp_not:n}. |
| 317 |
% The object name must be unique. The command uses the content of the local |
| 318 |
% dictionaries |l_pdffile|, |l_pdffile/streamParams| and |l_pdffile/Filespec| |
| 319 |
% to setup the dictionary entries of the stream object and the /Filespec dictionary. |
| 320 |
% The /F and /UF entry are filled with \meta{target filename}. |
| 321 |
% If \meta{target filename} is empty the fix name \texttt{stream.txt} |
| 322 |
% is used instead. |
| 323 |
% |
| 324 |
% If the |l_pdffile| dictionary doesn't contain a |
| 325 |
% Subtype entry with the mimetype, the command tries to guess it |
| 326 |
% from the file extension of \meta{target filename}. |
| 327 |
% |
| 328 |
% \meta{target filename} doesn't need to be a file name with an extension, |
| 329 |
% but it is recommended as security settings in the pdf |
| 330 |
% viewer can restrict access to known file types. |
| 331 |
% |
| 332 |
% The stream should not be too long, at least PS imposes a size limit for strings. |
| 333 |
% \end{function} |
| 334 |
% |
| 335 |
% \begin{function}{\pdffile_filespec:nnn,\pdffile_filespec:nne} |
| 336 |
% \begin{syntax} |
| 337 |
% \cs{ pdffile_filespec:nnn }\Arg{object name} \Arg{file name} \Arg{stream object reference} |
| 338 |
% \end{syntax} |
| 339 |
% The previous commands are fine if stream and filespec dictionary can be created together. |
| 340 |
% But there are cases where the |filespec| dictionary should be referenced when the |
| 341 |
% stream object doesn't exist yet. For example in the |AF| key of a structure at |
| 342 |
% the begin of an environment where the stream is created from the body. |
| 343 |
% |
| 344 |
% This command allows to write a filespec dictionary alone and reference a previously |
| 345 |
% created stream. |
| 346 |
% |
| 347 |
% \begin{verbatim} |
| 348 |
% \pdf_object_new:n {module/filespec/A} % a new filespec object |
| 349 |
% \pdf_object_ref:n {module/filespec/A} % reference it somewhere, e.g. in AF |
| 350 |
% % now write the stream |
| 351 |
% \pdf_object_unnamed_write:nn { stream }{ {...}{content} } |
| 352 |
% % and fill and write the filespec dictionary: |
| 353 |
% \pdffile_filespec:nnn {module/filespec/A}{A.xml}{\pdf_object_ref_last:} |
| 354 |
% \end{verbatim} |
| 355 |
% |
| 356 |
% \end{function} |
| 357 |
% |
| 358 |
% \begin{variable}{\g_pdffile_mimetypes_prop} |
| 359 |
% This property contains a list of extensions and their mimetypes. |
| 360 |
% Values can be added or changed with the standard commands: |
| 361 |
% |
| 362 |
% |\prop_gput:Nnn \g_pdffile_mimetypes_prop {.abc}{text/plain}| |
| 363 |
% |
| 364 |
% The extension should start with a period, the mimetype should be given |
| 365 |
% as plain text (it will be escaped internally). Extensions with two periods |
| 366 |
% are not supported. |
| 367 |
% \end{variable} |
| 368 |
% |
| 369 |
% \begin{variable} {\g_pdffile_embed_pdfa_int,\g_pdffile_embed_nonpdfa_int} |
| 370 |
% These two integers hold the number of embedded files in PDF/A format |
| 371 |
% and non-PDF/A format and can be used for a rough test for the requirements |
| 372 |
% in l3pdfmeta |no_embed_content| (both should be zero) |
| 373 |
% and |only_pdfa_embed_content| (the second should be zero). |
| 374 |
% The commands |\pdffile_embed_stream:...| and |\pdffile_embed_file:...| |
| 375 |
% increase the integers. As the code can currently not detect if an embedded |
| 376 |
% file follows a PDF/A standard it simply goes by the extension: files embedded |
| 377 |
% as |.pdf| increase the first integer. |
| 378 |
% |
| 379 |
% |\pdffile_filespec:nnn| does \emph{not} increase the integers, |
| 380 |
% if this command is used it lies in the responsibility of the |
| 381 |
% author to adjust the integers. |
| 382 |
% |
| 383 |
% The integers are public so that users |
| 384 |
% can query and adjust the values, e.g. in tests for standard compliance. |
| 385 |
% \end{variable} |
| 386 |
% |
| 387 |
% \begin{variable}{\l_pdffile_source_name_str} |
| 388 |
% This variable is set at the begin of \cs{pdffile_embed_file:nnn}. It can be |
| 389 |
% (and is) used in the file dictionaries, see table~\ref{tab:filedict} for examples. |
| 390 |
% \end{variable} |
| 391 |
% |
| 392 |
% \begin{variable} {\g_pdffile_embed_prop} |
| 393 |
% This property holds a list of embedded files. It is used by the following |
| 394 |
% show command. The keys are the object names, the argument holds a key word, |
| 395 |
% the source file name and the target file name. It stores a file only if the |
| 396 |
% boolean \cs{l_pdffile_embed_show_bool} is true when the file is embedded. |
| 397 |
% \end{variable} |
| 398 |
% \begin{variable} {\l_pdffile_embed_show_bool} |
| 399 |
% This boolean is used to decided if a file should be stored in the |
| 400 |
% property or not. As storing can be slow if there are many files, it is false by |
| 401 |
% default. |
| 402 |
% \end{variable} |
| 403 |
% \begin{function}{\pdffile_embed_show:} |
| 404 |
% This shows the stored embedded files with their source and target name. |
| 405 |
% \end{function} |
| 406 |
% |
| 407 |
% \subsection{Example} |
| 408 |
% \begin{verbatim} |
| 409 |
% \group_begin: |
| 410 |
% %set the relationship: |
| 411 |
% \pdfdict_put:nnn {l_pdffile/Filespec} {AFRelationship}{/Source} |
| 412 |
% %set the description key. The text must first be converted: |
| 413 |
% \pdf_string_from_unicode:nnN {utf16/string} |
| 414 |
% {this~is~an~odd~description~with~öäü} |
| 415 |
% \l_tmpa_str |
| 416 |
% \pdfdict_put:nne {l_pdffile/Filespec} {Desc}{\l_tmpa_str} |
| 417 |
% %embeds testinput.txt and calls it grüße.txt |
| 418 |
% \pdffile_embed_file:nnn {testinput.txt}{grüße.txt}{mymodule/example1} |
| 419 |
% %reference it in the panel |
| 420 |
% \pdfmanagement_add:nne |
| 421 |
% {Catalog/Names} |
| 422 |
% {EmbeddedFiles} |
| 423 |
% {\pdf_object_ref:n{mymodule/example1}} |
| 424 |
% \group_end: |
| 425 |
% \end{verbatim} |
| 426 |
% \end{documentation} |
| 427 |
% |
| 428 |
% \begin{implementation} |
| 429 |
% |
| 430 |
% \section{\pkg{l3pdffile} implementation} |
| 431 |
% |
| 432 |
% \begin{macrocode} |
| 433 |
%<*header> |
| 434 |
\ProvidesExplPackage{l3pdffile}{2026-05-26}{0.97c} |
| 435 |
{embedding and referencing files in PDF---LaTeX PDF management bundle} |
| 436 |
\RequirePackage{l3pdftools} %temporarily!! |
| 437 |
%</header> |
| 438 |
% \end{macrocode} |
| 439 |
% |
| 440 |
% \begin{macrocode} |
| 441 |
%<*package> |
| 442 |
%<@@=pdffile> |
| 443 |
\cs_new_protected:Npn \@@_filename_convert_to_print:nN #1 #2 |
| 444 |
{\pdf_string_from_unicode:nnN {utf16/hex}{#1}{#2}} |
| 445 |
% \end{macrocode} |
| 446 |
% \subsection{Messages} |
| 447 |
% \begin{macrocode} |
| 448 |
\msg_new:nnn { pdffile } { file-not-found } |
| 449 |
{ |
| 450 |
File~'\tl_to_str:n{#1}'~not~found |
| 451 |
} |
| 452 |
|
| 453 |
\msg_new:nnn { pdffile } { mimetype-missing } |
| 454 |
{ |
| 455 |
Mime~type~not~set~for~file~'\tl_to_str:n{#1}' |
| 456 |
} |
| 457 |
|
| 458 |
\msg_new:nnn { pdffile } { target-name-missing } |
| 459 |
{ |
| 460 |
a~target~name~for~the~/Filespec~dictionary~is~missing. |
| 461 |
} |
| 462 |
|
| 463 |
\msg_new:nnn { pdffile } { object-exists } |
| 464 |
{ |
| 465 |
object~name~'#1'~is~already~used. |
| 466 |
} |
| 467 |
|
| 468 |
\msg_new:nnn { pdffile } { show-files } |
| 469 |
{ |
| 470 |
The~following~files~have~been~embedded\\ |
| 471 |
#1 |
| 472 |
} |
| 473 |
% \end{macrocode} |
| 474 |
% |
| 475 |
% \subsection{Variables} |
| 476 |
% \begin{variable} |
| 477 |
% { |
| 478 |
% \l_@@_tmpa_tl, |
| 479 |
% \l_@@_tmpb_tl, |
| 480 |
% \g_@@_tmpa_tl, |
| 481 |
% \l_@@_tmpa_str, |
| 482 |
% \l_@@_tmpb_str, |
| 483 |
% \l_@@_ext_str, |
| 484 |
% \l_@@_automimetype_tl, |
| 485 |
% \l_@@_embed_ref_tl |
| 486 |
% } |
| 487 |
% temporary variables: generic, for extension, subtype, to store the ref. |
| 488 |
% \end{variable} |
| 489 |
% \begin{macrocode} |
| 490 |
\tl_new:N \l_@@_tmpa_tl |
| 491 |
\tl_new:N \l_@@_tmpb_tl |
| 492 |
\tl_new:N \g_@@_tmpa_tl |
| 493 |
\str_new:N \l_@@_tmpa_str |
| 494 |
\str_new:N \l_@@_tmpb_str |
| 495 |
\str_new:N \l_@@_ext_str |
| 496 |
\tl_new:N \l_@@_automimetype_tl |
| 497 |
\tl_new:N \l_@@_embed_ref_tl |
| 498 |
% \end{macrocode} |
| 499 |
% \begin{variable} {\g_pdffile_mimetypes_prop} |
| 500 |
% This variable holds common mimetypes. The key is an extension with (one) period, |
| 501 |
% the value the description, e.g. \texttt{text/csv}. |
| 502 |
% \end{variable} |
| 503 |
% \begin{macrocode} |
| 504 |
\prop_new:N \g_pdffile_mimetypes_prop |
| 505 |
\prop_gset_from_keyval:Nn \g_pdffile_mimetypes_prop |
| 506 |
{ |
| 507 |
,.css = text/css |
| 508 |
,.csv = text/csv |
| 509 |
,.html= text/html |
| 510 |
,.dtx = text/plain %or application/x-tex, not in iana.org list |
| 511 |
,.eps = application/postscript |
| 512 |
,.jpg = image/jpeg |
| 513 |
,.mp4 = video/mp4 |
| 514 |
,.pdf = application/pdf |
| 515 |
,.png = image/png |
| 516 |
,.tex = application/x-tex %not in iana.org list but probably better |
| 517 |
,.txt = text/plain |
| 518 |
,.sty = text/plain |
| 519 |
,.xml = application/xml |
| 520 |
} |
| 521 |
% \end{macrocode} |
| 522 |
% |
| 523 |
% \begin{variable} {\g_pdffile_embed_pdfa_int,\g_pdffile_embed_nonpdfa_int} |
| 524 |
% These two integers hold the number of embedded files in PDF/A format |
| 525 |
% and non-PDF/A format and can be used for a rough test for the requirements |
| 526 |
% in l3pdfmeta |no_embed_content| (both should be zero) |
| 527 |
% and |only_pdfa_embed_content| (the second should be zero). |
| 528 |
% The commands |\pdffile_embed_stream:...| and |\pdffile_embed_file:...| |
| 529 |
% increase the integers. As the code can currently not detect if an embedded |
| 530 |
% file follows a PDF/A standard it simply goes by the extension: files embedded |
| 531 |
% as |.pdf| increase the first integer. |
| 532 |
% |
| 533 |
% |\pdffile_filespec:nnn| does \emph{not} increase the integers, |
| 534 |
% if this command is used it lies in the responsibility of the |
| 535 |
% author to adjust the integers. |
| 536 |
% |
| 537 |
% The integers are public so that users |
| 538 |
% can query and adjust the values, e.g. in tests for standard compliance. |
| 539 |
% \begin{macrocode} |
| 540 |
\int_new:N\g_pdffile_embed_pdfa_int |
| 541 |
\int_new:N\g_pdffile_embed_nonpdfa_int |
| 542 |
% \end{macrocode} |
| 543 |
% \end{variable} |
| 544 |
% \begin{variable} |
| 545 |
% { |
| 546 |
% \l_pdffile_source_name_str |
| 547 |
% } |
| 548 |
% \cs{l_pdffile_source_name_str} will be set at the begin of the command and |
| 549 |
% contains the full file name and can be used e.g. with \cs{file_timestamp:n}. |
| 550 |
% \end{variable} |
| 551 |
% \begin{macrocode} |
| 552 |
\str_new:N \l_pdffile_source_name_str |
| 553 |
% \end{macrocode} |
| 554 |
% Here we define and setup the local dictionaries. |
| 555 |
% We add a ModDate to ensure that there is an entry if |
| 556 |
% associated files are used. |
| 557 |
% \begin{macrocode} |
| 558 |
\pdfdict_new:n { l_pdffile } |
| 559 |
\pdfdict_put:nnn { l_pdffile }{Type}{/EmbeddedFile} |
| 560 |
\pdfdict_new:n { l_pdffile/Params } |
| 561 |
\pdfdict_put:nnn { l_pdffile/Params } |
| 562 |
{ModDate} { (\file_timestamp:n { \l_pdffile_source_name_str }) } |
| 563 |
\pdfdict_put:nnn { l_pdffile/Params } |
| 564 |
{Size} { \file_size:n { \l_pdffile_source_name_str } } |
| 565 |
\pdfdict_put:nnn { l_pdffile/Params } |
| 566 |
{CheckSum} { <\file_mdfive_hash:n { \l_pdffile_source_name_str }> } |
| 567 |
\pdfdict_new:n { l_pdffile/streamParams } |
| 568 |
\pdfdict_put:nnn { l_pdffile/streamParams } |
| 569 |
{ModDate} { |
| 570 |
( |
| 571 |
D:\int_use:N\c_sys_year_int |
| 572 |
\int_compare:nNnT{\c_sys_month_int}<{10}{0} |
| 573 |
\int_use:N\c_sys_month_int |
| 574 |
\int_compare:nNnT{\c_sys_day_int}<{10}{0} |
| 575 |
\int_use:N\c_sys_day_int |
| 576 |
) |
| 577 |
} |
| 578 |
\pdfdict_new:n { l_pdffile/Filespec } |
| 579 |
\pdfdict_put:nnn { l_pdffile/Filespec } |
| 580 |
{Type} { /Filespec } |
| 581 |
\pdfdict_put:nnn { l_pdffile/Filespec } |
| 582 |
{AFRelationship} { /Unspecified } |
| 583 |
|
| 584 |
% \end{macrocode} |
| 585 |
% \begin{variable}{\g_pdffile_embed_prop,\l_pdffile_embed_show_bool} |
| 586 |
% we record here the relation\\% |
| 587 |
% \meta{object name} $\Rightarrow$ |
| 588 |
% \Arg{file/stream or empty}\Arg{sourcename}\Arg{targetname} |
| 589 |
% if the boolean is true% |
| 590 |
% \begin{macrocode} |
| 591 |
\prop_new_linked:N \g_pdffile_embed_prop |
| 592 |
\bool_new:N \l_pdffile_embed_show_bool |
| 593 |
% \end{macrocode} |
| 594 |
% \end{variable} |
| 595 |
% \begin{macro}{\pdffile_embed_show:} |
| 596 |
% \begin{macrocode} |
| 597 |
\cs_new_protected:Npn \pdffile_embed_show: |
| 598 |
{ |
| 599 |
\msg_show:nne |
| 600 |
{pdffile}{show-files} |
| 601 |
{ |
| 602 |
\prop_map_function:NN {\g_pdffile_embed_prop} \msg_show_item:nn |
| 603 |
} |
| 604 |
} |
| 605 |
% \end{macrocode} |
| 606 |
% \end{macro} |
| 607 |
% |
| 608 |
% \begin{macro}{\pdffile_embed_file:nnn, \pdffile_embed_stream:nnn, \pdffile_embed_stream:nnN} |
| 609 |
% At first a command to set the mimetype. It either uses the current value |
| 610 |
% in the file dictionary, or tries to guess it from the extension. |
| 611 |
% |
| 612 |
% \begin{macro}{\@@_mimetype_set:nNN,\@@_mimetype_set:VNN} |
| 613 |
% \begin{macro}{\@@_fstream_write:nN, \@@_fstream_write:VN} |
| 614 |
% \begin{macro}{\@@_stream_write:nN, \@@_stream_write:VN} |
| 615 |
% \begin{macrocode} |
| 616 |
%#1 file name, |
| 617 |
%#2 tl to return the (printed) value for the guessed mimetype |
| 618 |
%#3 tl to return the file extension (that is a string) |
| 619 |
\cs_new_protected:Npn \@@_mimetype_set:nNN #1 #2 #3 |
| 620 |
{ |
| 621 |
\file_parse_full_name:nNNN |
| 622 |
{#1} |
| 623 |
\l_@@_tmpa_str %unused |
| 624 |
\l_@@_tmpb_str %unused |
| 625 |
\l_@@_ext_str |
| 626 |
%check if Subtype has been set |
| 627 |
\pdfdict_get:nnN { l_pdffile}{Subtype}\l_@@_tmpa_tl |
| 628 |
%if not look up in the prop: |
| 629 |
\quark_if_no_value:NT \l_@@_tmpa_tl |
| 630 |
{ |
| 631 |
\prop_get:NVNTF |
| 632 |
\g_pdffile_mimetypes_prop |
| 633 |
\l_@@_ext_str |
| 634 |
\l_@@_tmpb_tl |
| 635 |
{ |
| 636 |
\tl_set:Ne #2 {/Subtype~\pdf_name_from_unicode_e:V \l_@@_tmpb_tl} |
| 637 |
} |
| 638 |
{ |
| 639 |
\msg_warning:nne { pdffile }{ mimetype-missing} {#1} |
| 640 |
\tl_clear:N #2 |
| 641 |
} |
| 642 |
} |
| 643 |
\tl_set_eq:NN #3 \l_@@_ext_str |
| 644 |
} |
| 645 |
|
| 646 |
\cs_generate_variant:Nn \@@_mimetype_set:nNN {VNN} |
| 647 |
|
| 648 |
% #1 tl containing a file extension |
| 649 |
\cs_new_protected:Npn \@@_count_embed:N #1 |
| 650 |
{ |
| 651 |
\str_if_eq:VnTF #1 {.pdf} |
| 652 |
{\int_gincr:N \g_pdffile_embed_pdfa_int } |
| 653 |
{\int_gincr:N \g_pdffile_embed_nonpdfa_int } |
| 654 |
} |
| 655 |
|
| 656 |
%#1 file name, |
| 657 |
%#2 tl, should be empty or contain /Subtype /mimetype |
| 658 |
% e.g. result from \@@_mimetype_set:nNN |
| 659 |
\cs_new_protected:Npn \@@_fstream_write:nN #1 #2 |
| 660 |
{ |
| 661 |
\pdf_object_unnamed_write:ne { fstream } |
| 662 |
{ |
| 663 |
{ |
| 664 |
#2 |
| 665 |
\pdfdict_use:n { l_pdffile} |
| 666 |
\pdfdict_if_empty:nF { l_pdffile/Params} |
| 667 |
{ |
| 668 |
/Params |
| 669 |
<< |
| 670 |
\pdfdict_use:n { l_pdffile/Params} |
| 671 |
>> |
| 672 |
} |
| 673 |
} |
| 674 |
{ #1 } |
| 675 |
} |
| 676 |
\tl_clear:N \l_@@_automimetype_tl |
| 677 |
} |
| 678 |
|
| 679 |
\cs_generate_variant:Nn \@@_fstream_write:nN {VN} |
| 680 |
|
| 681 |
%#1 file content |
| 682 |
%#2 tl, should be empty or contain /Subtype /mimtype |
| 683 |
% e.g. result from \@@_mimetype_set:nNN |
| 684 |
\cs_new_protected:Npn \@@_stream_write:nN #1 #2 |
| 685 |
{ |
| 686 |
\pdf_object_unnamed_write:ne { stream } |
| 687 |
{ |
| 688 |
{ |
| 689 |
#2 |
| 690 |
\pdfdict_use:n { l_pdffile} |
| 691 |
\pdfdict_if_empty:nF { l_pdffile/streamParams} |
| 692 |
{ |
| 693 |
/Params |
| 694 |
<< |
| 695 |
\pdfdict_use:n { l_pdffile/streamParams} |
| 696 |
>> |
| 697 |
} |
| 698 |
} |
| 699 |
{ \exp_not:n { #1 } } |
| 700 |
} |
| 701 |
\tl_clear:N \l_@@_automimetype_tl |
| 702 |
} |
| 703 |
|
| 704 |
\cs_generate_variant:Nn \@@_stream_write:nN {VN} |
| 705 |
|
| 706 |
%#1 symbolic name of dict object |
| 707 |
%#2 target file name, |
| 708 |
%#3 object ref of the file stream. |
| 709 |
\cs_new_protected:Npn \@@_filespec_write:nnn #1 #2 #3 |
| 710 |
{ |
| 711 |
\tl_if_blank:nTF { #2 } |
| 712 |
{ |
| 713 |
\msg_error:nn {pdffile}{target-name-missing} |
| 714 |
} |
| 715 |
{ |
| 716 |
\group_begin: |
| 717 |
\pdf_string_from_unicode:nnN {utf8/string}{#2}\l_@@_tmpa_str |
| 718 |
\pdfdict_put:nne {l_pdffile/Filespec}{F} { \l_@@_tmpa_str } |
| 719 |
\@@_filename_convert_to_print:nN { #2 } \l_@@_tmpa_str |
| 720 |
\pdfdict_put:nne {l_pdffile/Filespec}{UF}{ \l_@@_tmpa_str } |
| 721 |
\pdf_object_write:nne { #1 } { dict } |
| 722 |
{ |
| 723 |
\pdfdict_use:n { l_pdffile/Filespec} |
| 724 |
\tl_if_empty:nF { #3 } |
| 725 |
{ |
| 726 |
/EF <</F~#3 /UF~#3>> |
| 727 |
} |
| 728 |
} |
| 729 |
\group_end: |
| 730 |
} |
| 731 |
} |
| 732 |
|
| 733 |
%#1 target file name #2 object ref of file stream #3 reference of object |
| 734 |
\cs_new_protected:Npn \@@_filespec_write:nnN #1 #2 #3 |
| 735 |
{ |
| 736 |
\tl_if_blank:nTF { #1 } |
| 737 |
{ |
| 738 |
\msg_error:nn {pdffile}{target-name-missing} |
| 739 |
} |
| 740 |
{ |
| 741 |
\group_begin: |
| 742 |
\pdf_string_from_unicode:nnN {utf8/string}{#1}\l__pdffile_tmpa_str |
| 743 |
\pdfdict_put:nne {l_pdffile/Filespec}{F} { \l_@@_tmpa_str } |
| 744 |
\@@_filename_convert_to_print:nN { #1 } \l_@@_tmpa_str |
| 745 |
\pdfdict_put:nne {l_pdffile/Filespec}{UF}{ \l_@@_tmpa_str } |
| 746 |
\pdf_object_unnamed_write:ne {dict} |
| 747 |
{ |
| 748 |
\pdfdict_use:n { l_pdffile/Filespec} |
| 749 |
\tl_if_empty:nF { #2 } |
| 750 |
{ |
| 751 |
/EF <</F~#2 /UF~#2>> |
| 752 |
} |
| 753 |
} |
| 754 |
\tl_gset:Ne\g_@@_tmpa_tl{\pdf_object_ref_last:} |
| 755 |
\group_end: |
| 756 |
\tl_set_eq:NN#3\g_@@_tmpa_tl |
| 757 |
} |
| 758 |
} |
| 759 |
|
| 760 |
\cs_set_eq:NN \pdffile_filespec:nnn \@@_filespec_write:nnn |
| 761 |
\cs_generate_variant:Nn \pdffile_filespec:nnn {nne,nnx} |
| 762 |
%#1 {source filename} |
| 763 |
%#2 {target filename} |
| 764 |
%#3 { filespec object name } (will internally get a prefix! ??) |
| 765 |
\cs_new_protected:Npn \pdffile_embed_file:nnn #1 #2 #3 |
| 766 |
{ % if #1 empty => only filespec |
| 767 |
% if #2 empty => = #1 |
| 768 |
\pdf_object_if_exist:nTF { #3 } |
| 769 |
{ |
| 770 |
\msg_error:nnn { pdffile }{ object-exists } { #3 } |
| 771 |
} |
| 772 |
{ |
| 773 |
\tl_if_blank:nTF { #1 } |
| 774 |
{ |
| 775 |
\tl_set:Nn \l_@@_embed_ref_tl {} |
| 776 |
} |
| 777 |
{ |
| 778 |
\file_get_full_name:nNTF {#1} \l_pdffile_source_name_str |
| 779 |
{ |
| 780 |
\@@_mimetype_set:VNN |
| 781 |
\l_pdffile_source_name_str |
| 782 |
\l_@@_automimetype_tl |
| 783 |
\l_@@_tmpa_tl |
| 784 |
\@@_count_embed:N \l_@@_tmpa_tl |
| 785 |
\@@_fstream_write:VN |
| 786 |
\l_pdffile_source_name_str |
| 787 |
\l_@@_automimetype_tl |
| 788 |
\tl_set:Ne \l_@@_embed_ref_tl { \pdf_object_ref_last: } |
| 789 |
} |
| 790 |
{ |
| 791 |
\msg_error:nnn { pdffile }{ file-not-found }{ #1 } |
| 792 |
} |
| 793 |
|
| 794 |
} |
| 795 |
\bool_if:NT\l_pdffile_embed_show_bool |
| 796 |
{ |
| 797 |
\prop_gput:Nne |
| 798 |
\g_pdffile_embed_prop |
| 799 |
{ #3 } |
| 800 |
{ |
| 801 |
{ \tl_if_blank:nTF { #1 } {filespec}{file} } |
| 802 |
{\l_pdffile_source_name_str} |
| 803 |
{ |
| 804 |
\tl_if_blank:nTF { #2 } |
| 805 |
{ \l_pdffile_source_name_str } |
| 806 |
{ \tl_to_str:n{#2}} |
| 807 |
} |
| 808 |
} |
| 809 |
} |
| 810 |
\tl_if_blank:nTF { #2 } |
| 811 |
{ |
| 812 |
\pdf_object_new:n { #3 } |
| 813 |
\exp_args:Nnne |
| 814 |
\@@_filespec_write:nnn |
| 815 |
%#1 dict, #2 target file name, #3 object ref |
| 816 |
{ #3 } |
| 817 |
{ #1 } |
| 818 |
{\l_@@_embed_ref_tl} |
| 819 |
} |
| 820 |
{ |
| 821 |
\pdf_object_new:n { #3 } |
| 822 |
\exp_args:Nnne |
| 823 |
\@@_filespec_write:nnn |
| 824 |
%#1 dict, #2 target file name, #3 object ref |
| 825 |
{ #3 } |
| 826 |
{ #2 } |
| 827 |
{\l_@@_embed_ref_tl} |
| 828 |
} |
| 829 |
} |
| 830 |
} |
| 831 |
|
| 832 |
|
| 833 |
%#1{stream content} |
| 834 |
%#2{target filename} |
| 835 |
%#3{file object name } |
| 836 |
\cs_new_protected:Npn \pdffile_embed_stream:nnn #1 #2 #3 |
| 837 |
{ |
| 838 |
% if #2 empty => error |
| 839 |
\pdf_object_if_exist:nTF { #3 } |
| 840 |
{ |
| 841 |
\msg_error:nnn { pdffile }{ object-exists } { #3 } |
| 842 |
} |
| 843 |
{ |
| 844 |
\bool_if:NT\l_pdffile_embed_show_bool |
| 845 |
{ |
| 846 |
\prop_gput:Nne |
| 847 |
\g_pdffile_embed_prop |
| 848 |
{ #3 } |
| 849 |
{{stream}{}{\tl_if_blank:nTF {#2}{stream.txt}{\exp_not:n{#2}}}} |
| 850 |
} |
| 851 |
\tl_if_blank:nTF {#2} |
| 852 |
{ \@@_mimetype_set:nNN {stream.txt}\l_@@_automimetype_tl \l_@@_tmpa_tl} |
| 853 |
{ \@@_mimetype_set:nNN { #2 } \l_@@_automimetype_tl \l_@@_tmpa_tl } |
| 854 |
\@@_count_embed:N \l_@@_tmpa_tl |
| 855 |
\@@_stream_write:nN |
| 856 |
{ #1 } |
| 857 |
\l_@@_automimetype_tl |
| 858 |
\tl_set:Ne \l_@@_embed_ref_tl { \pdf_object_ref_last: } |
| 859 |
\pdf_object_new:n { #3 } |
| 860 |
\exp_args:Nnee |
| 861 |
\@@_filespec_write:nnn |
| 862 |
%#1 dict, #2 target file name, #3 object ref |
| 863 |
{ #3 } |
| 864 |
{ \tl_if_blank:nTF {#2}{stream.txt}{\exp_not:n{#2}} } |
| 865 |
{\l_@@_embed_ref_tl} |
| 866 |
} |
| 867 |
} |
| 868 |
|
| 869 |
\cs_new_protected:Npn \pdffile_embed_stream:nnN #1 #2 #3 |
| 870 |
{ |
| 871 |
\tl_if_blank:nTF {#2} |
| 872 |
{ \@@_mimetype_set:nNN {stream.txt}\l_@@_automimetype_tl \l_@@_tmpa_tl} |
| 873 |
{ \@@_mimetype_set:nNN { #2 } \l_@@_automimetype_tl \l_@@_tmpa_tl } |
| 874 |
\@@_count_embed:N\l_@@_tmpa_tl |
| 875 |
\@@_stream_write:nN |
| 876 |
{ #1 } |
| 877 |
\l_@@_automimetype_tl |
| 878 |
\tl_set:Ne \l_@@_embed_ref_tl { \pdf_object_ref_last: } |
| 879 |
\exp_args:Nee |
| 880 |
\@@_filespec_write:nnN |
| 881 |
%#1 target file name, #2 object ref of stream, #3 object ref of filespec |
| 882 |
{ \tl_if_blank:nTF {#2}{stream.txt}{\exp_not:n{#2}} } |
| 883 |
{\l_@@_embed_ref_tl} |
| 884 |
#3 |
| 885 |
\bool_if:NT \l_pdffile_embed_show_bool |
| 886 |
{ |
| 887 |
\prop_gput:Nee |
| 888 |
\g_pdffile_embed_prop |
| 889 |
{ #3 } |
| 890 |
{{stream}{}{\tl_if_blank:nTF {#2}{stream.txt}{\exp_not:n{#2}}}} |
| 891 |
} |
| 892 |
} |
| 893 |
|
| 894 |
|
| 895 |
% \end{macrocode} |
| 896 |
% \end{macro} |
| 897 |
% \end{macro} |
| 898 |
% \end{macro} |
| 899 |
% \end{macro} |
| 900 |
% \begin{macrocode} |
| 901 |
%</package> |
| 902 |
% \end{macrocode} |
| 903 |
% |
| 904 |
% \end{implementation} |
| 905 |
% |
| 906 |
% \PrintIndex |