1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
%%
%% This is file `pdfmanagement-firstaid.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pdfmanagement-firstaid.dtx (with options: `package')
%%
%% Copyright (C) 2019-2021 The LaTeX Project
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version. The latest
%% version of this license is in the file:
%%
%% https://www.latex-project.org/lppl.txt
%%
%% This file is part of the "LaTeX PDF management testphase bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% File: pdfmanagement-firstaid.dtx
\ProvidesExplPackage{pdfmanagement-firstaid}{2022-02-16}{0.95l}
{LaTeX PDF management testphase bundle / firstaid-patches}
\clist_map_inline:nn {pgf,transparent,hyperxmp,pdflscape,xcolor,color,beamer,output}
{
\bool_new:c { g__pdfmanagement_firstaid_#1_bool }
\bool_gset_true:c { g__pdfmanagement_firstaid_#1_bool }
}
\clist_map_inline:Nn \g__pdfmanagement_firstaidoff_clist
{
\bool_if_exist:cT { g__pdfmanagement_firstaid_#1_bool }
{
\bool_gset_false:c { g__pdfmanagement_firstaid_#1_bool }
}
}
\msg_new:nnn { pdfmanagement } { firstaid }
{ loading~pdfmanagement~firstaid~code~for~#1 }
\bool_if:NT \g__pdfmanagement_firstaid_output_bool
{
\RequirePackage{output-patches-tmp-ltx}
}
\bool_if:NT \g__pdfmanagement_firstaid_beamer_bool
{
\color_set:nnn{.5~.5~.5}{rgb}{0.5,0.5,0.5}
}
\bool_if:NT \g__pdfmanagement_firstaid_color_bool
{
\declare@file@substitution{color.sty}{color-ltx.sty}
}
\bool_if:NT \g__pdfmanagement_firstaid_xcolor_bool
{
\AddToHook
{
package/xcolor/after
}
{\RequirePackage{xcolor-patches-tmp-ltx}\XC@@names}
}
\bool_if:NT \g__pdfmanagement_firstaid_pgf_bool
{
\msg_info:nnn{pdfmanagement }{firstaid}{pgf}
\AddToHook
{
file/pgfrcs.sty/after
}
{
\cs_set_eq:NN
\__pdfmanagement_pgfori_pgfutil@setuppdfresources
\pgfutil@setuppdfresources
\def\pgfutil@setuppdfresources
{
\pdfmanagement_if_active:TF
{
\__pdfmanagement_pgf_sys_setuppdfresources_plain:
}
{
\__pdfmanagement_pgfori_pgfutil@setuppdfresources
}
}
}
}
\cs_new_protected:Npn \__pdfmanagement_pgf_sys_setuppdfresources_plain:
{
%objects are already created ...
\def\pgf@sys@pdf@possible@resources
{
/ColorSpace~\pdf_object_ref:n {__pdf/Page/Resources/ColorSpace}
/Pattern ~\pdf_object_ref:n {__pdf/Page/Resources/Pattern}
/ExtGState ~\pdf_object_ref:n {__pdf/Page/Resources/ExtGState}
}
\let\pgf@sys@pdf@check@resources=\relax%
%not sure if needed, but perhaps the lists are used somewhere else ...
\let\pgf@sys@pgf@resource@list@extgs=\pgfutil@empty%
\let\pgf@sys@pgf@resource@list@patterns=\pgfutil@empty%
\let\pgf@sys@pgf@resource@list@colorspaces=\pgfutil@empty%
% the commands to add page resources
\def\pgf@sys@addpdfresource@extgs@plain##1
{
%\exp_after:wN %for transparent which passes a command
\__pdfmanagement_patch_pgfextgs:w ##1\q_stop
}
\def\pgf@sys@addpdfresource@patterns@plain##1
{
\__pdfmanagement_patch_pgfpatterns:w ##1\q_stop
}
\def\pgf@sys@addpdfresource@colorspaces@plain##1
{
\__pdfmanagement_patch_pgfcolorspaces:w ##1\q_stop
}
}
\cs_new:Npn \__pdfmanagement_split_dict_entry_aux:NNw #1 #2 /#3~#4\q_stop
{
\tl_set:Nn #1 {#3}
\tl_set:Nn #2 {#4}
}
\cs_generate_variant:Nn \tl_trim_spaces:n{V}
\cs_generate_variant:Nn \pdfmanagement_add:nnn {nex}
\cs_new:Npn \__pdfmanagement_patch_pgfextgs:w #1/#2<<#3>>#4\q_stop
{
\tl_set:Nx\l_tmpa_tl{#2}
\pdfmanagement_add:nex
{Page/Resources/ExtGState}{\tl_trim_spaces:V\l_tmpa_tl}{<<#3 #4>>}
}
\cs_new:Npn \__pdfmanagement_patch_pgfpatterns:w #1/#2\space#3\q_stop
{
\pdfmanagement_add:nex
{Page/Resources/Pattern}{\tl_trim_spaces:n{#2}}{#3}
}
\cs_new:Npn \__pdfmanagement_patch_pgfcolorspaces:w #1/#2[#3]#4\q_stop
{
\pdfmanagement_add:nex
{Page/Resources/ColorSpace}{\tl_trim_spaces:n{#2}}{[#3]}
}
\bool_if:NT \g__pdfmanagement_firstaid_transparent_bool
{
\declare@file@substitution{transparent.sty}{transparent-ltx.sty}
}
\bool_if:NT \g__pdfmanagement_firstaid_pdflscape_bool
{
\declare@file@substitution{pdflscape.sty}{pdflscape-ltx.sty}
}
\bool_if:NT \g__pdfmanagement_firstaid_hyperxmp_bool
{
\AddToHook
{
file/hyperxmp.sty/after
}
{\RequirePackage{hyperxmp-patches-tmp-ltx}}
}
\hook_gput_code:nnn {begindocument} {pdf}
{
\tl_if_exist:NT \spc@op
{
\def\spc@Pageresources#1{}
}
}
\hook_gput_code:nnn {begindocument/end} {pdf}
{
\tl_if_exist:NT \spc@op
{
\__pdf_backend_object_new:nn {__spc_extgstate_op_false}{dict}
\__pdf_backend_object_write:nn
{__spc_extgstate_op_false}
{/Type /ExtGState~/op~false~/OP~false}
\pdfmanagement_add:nnn
{Page/Resources/ExtGState}
{SPCko}
{\__pdf_backend_object_ref:n {__spc_extgstate_op_false}}
\__pdf_backend_object_new:nn {__spc_extgstate_op_true0}{dict}
\__pdf_backend_object_write:nn
{__spc_extgstate_op_true0}
{/Type /ExtGState~/op~true~/OP~true~/OPM~0}%
\pdfmanagement_add:nnn
{Page/Resources/ExtGState}
{SPCmz}
{\__pdf_backend_object_ref:n {__spc_extgstate_op_true0}}
\__pdf_backend_object_new:nn {__spc_extgstate_op_true1}{dict}
\__pdf_backend_object_write:nn
{__spc_extgstate_op_true1}
{/Type /ExtGState~/op~true~/OP~true~/OPM~1}%
\pdfmanagement_add:nnn
{Page/Resources/ExtGState}
{SPCop}
{\__pdf_backend_object_ref:n {__spc_extgstate_op_true1}}
}
}
%%
%%
%% End of file `pdfmanagement-firstaid.sty'.
|