Debian Codegraph @

texmf-dist/source/latex/pdfmanagement/l3pdfxform.dtx

raw
1 % \iffalse meta-comment
2 %
3 %% File: l3pdfxform.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 bundle 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 \usepackage{array,booktabs}
30 \hypersetup{pdfauthor=The LaTeX Project,pdftitle=l3pdfxform (LaTeX PDF management bundle)}
31
32 \begin{document}
33 \DocInput{\jobname.dtx}
34 \end{document}
35 %</driver>
36 % \fi
37 %
38 % \title{^^A
39 % The \pkg{l3pdfxform} module\\ Commands for form XObjects ^^A
40 % \\ \LaTeX{} PDF management bundle
41 % }
42 %
43 % \author{^^A
44 % The \LaTeX{} Project\thanks
45 % {^^A
46 % E-mail:
47 % \href{mailto:[email protected]}
48 % {[email protected]}^^A
49 % }^^A
50 % }
51 %
52 % \date{Version 0.97c, released 2026-05-26}
53 %
54 % \maketitle
55 % \begin{documentation}
56 %
57 % \section{\pkg{l3pdfxform} documentation}
58 % This module contains a number of commands to create \enquote{form XObjects},
59 % for which pdf\TeX{} introduced the short name \enquote{xforms}.
60 %
61 % The status is still beta.
62 % The dvips route is now better supported but there are open issues
63 % if landscape pages are involved or if the objects are larger than the page.
64 % With dvips the creation of a form involves typesetting and so can affect spacing.
65 %
66 % Probably some of the function will also need to be enhanced by hooks.
67 %
68 % \begin{function}[added = 2019-08-05,updated=2021-02-14]
69 % {
70 % \pdfxform_new:nnn
71 % }
72 % \begin{syntax}
73 % \cs{pdfxform_new:nnn} \Arg{name} \Arg{attributes} \Arg{content}
74 % \end{syntax}
75 % This command create a new form XObject that can be used as appearance or
76 % directly later.
77 % If the \meta{content} contains BDC-marks it should \emph{not} be given as a
78 % previously typeset box, but directly so that the names of the
79 % BDC-marks can be added to the resources of the xform. The xform will automatically
80 % include the resources of the current page.
81 % The content will be typeset in a hbox. With pdflatex and luatex
82 % the surrounding color is \emph{not} stored in the form XObject
83 % but should be if wanted added e.g. with |\color_select:n{.}|. This keeps
84 % the option of color injection open.
85 % \end{function}
86 % \begin{function}[added = 2019-08-05]
87 % {
88 % \pdfxform_use:n
89 % }
90 % \begin{syntax}
91 % \cs{pdfxform_use:n} \Arg{name}
92 % \end{syntax}
93 % This command uses (typesets) a previously created form XObject.
94 % If the surrounding color is different, it is injected in the form XObject with the
95 % engines pdftex or luatex.
96 % \end{function}
97 % \begin{function}[EXP,added = 2019-08-05]
98 % {
99 % \pdfxform_ref:n
100 % }
101 % \begin{syntax}
102 % \cs{pdfxform_ref:n} \Arg{name}
103 % \end{syntax}
104 % Inserts the appropriate information to reference the xform \meta{name}
105 % in for example appearance dictionaries.
106 % \end{function}
107 % \begin{function}[EXP,added = 2019-08-05]
108 % {
109 % \pdfxform_wd:n, \pdfxform_ht:n, \pdfxform_dp:n
110 % }
111 % \begin{syntax}
112 % \cs{pdfxform_wd:n} \Arg{name}
113 % \end{syntax}
114 % These command give back the sizes of the form XObject. The values are stored in
115 % tl-variables with the unit pt and not in dimensions!
116 % \end{function}
117 % \begin{function}[EXP,pTF,added = 2020-04-29]
118 % {
119 % \pdfxform_if_exist:n
120 % }
121 % \begin{syntax}
122 % \cs{pdfxform_if_exist_p:n} \Arg{name}
123 % \cs{pdfxform_if_exist:nTF} \Arg{name} \Arg{true code} \Arg{false code}
124 % \end{syntax}
125 % These commands tests if an xform with name \Arg{name} has been already defined.
126 % \end{function}%
127 % \end{documentation}
128 %
129 % \begin{implementation}
130 %
131 % \section{\pkg{l3pdfxform} implementation}
132 %
133 % \begin{macrocode}
134 %<@@=pdf>
135 %<*header>
136 \ProvidesExplPackage{l3pdfxform}{2026-05-26}{0.97c}
137 {command to create xforms (beta)---LaTeX PDF management bundle}
138 %</header>
139 % \end{macrocode}
140 % \subsection{Form XObject (pdfxform)}
141 % \begin{NOTE}{UF}
142 % - As in dvi mode the xform is immediate, this is done for pdftex/luatex too.
143 % If needed a delayed version can be added later.
144 % - the argument for attributes is needed to add e.g. /StructParents
145 % - it is not clear if an argument for additional resources is needed, probably they
146 % should / need to be added automatically.
147 % - code for adding ExtGState etc to the local resource is missing, will be
148 % added when the object name is clear.
149 % - should the size be stored in dim or tl?
150 % - dvips implementation is missing for ideas: pdfbase, atfi-dvips.def,
151 % \end{NOTE}
152 % \begin{macro}{\pdfxform_new:nnn}
153 % \begin{macrocode}
154 %<*package>
155 \cs_new_protected:Npn \pdfxform_new:nnn #1 #2 #3
156 {
157 \@@_backend_xform_new:nnnn { #1 } { #2 } { } { #3 }
158 }
159 % \end{macrocode}
160 % \end{macro}
161 % \begin{macro}{\pdfxform_use:n}
162 % \begin{macrocode}
163 \cs_new_protected:Npn \pdfxform_use:n #1
164 {
165 \@@_backend_xform_use:n { #1 }
166 }
167 % \end{macrocode}
168 % \end{macro}
169 % \begin{macro}{\pdfxform_ref:n,\pdfxform_ref:o}
170 % \begin{macrocode}
171 % expansion?
172 \cs_new:Npn \pdfxform_ref:n #1
173 {
174 \@@_backend_xform_ref:n { #1 }
175 }
176
177 \cs_generate_variant:Nn \pdfxform_ref:n {o}
178 % \end{macrocode}
179 % \end{macro}
180 % \begin{macro}{\pdfxform_wd:n,\pdfxform_ht:n,\pdfxform_dp:n,}
181 % \begin{macrocode}
182 \cs_new:Npn \pdfxform_wd:n #1
183 {
184 \tl_use:c { c_@@_backend_xform_wd_ \tl_to_str:n { #1 } _tl }
185 }
186
187 \cs_new:Npn \pdfxform_ht:n #1
188 {
189 \tl_use:c { c_@@_backend_xform_ht_ \tl_to_str:n { #1 } _tl }
190 }
191
192 \cs_new:Npn \pdfxform_dp:n #1
193 {
194 \tl_use:c { c_@@_backend_xform_dp_ \tl_to_str:n { #1 } _tl }
195 }
196 % \end{macrocode}
197 % \end{macro}
198 % \begin{macro}[pTF]{\pdfxform_if_exist:n}
199 % The command is defined in the backend (to avoid timing problems).
200 % \end{macro}
201 % \begin{macrocode}
202 %</package>
203 % \end{macrocode}
204 %
205 % \end{implementation}
206 %
207 % \PrintIndex