| 1 |
%% |
| 2 |
%% This is file `l3backend-pdf-dvips.def', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% l3backend-pdfmanagement.dtx (with options: `drivers,dvips') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2019-2026 The LaTeX Project |
| 10 |
%% |
| 11 |
%% It may be distributed and/or modified under the conditions of |
| 12 |
%% the LaTeX Project Public License (LPPL), either version 1.3c of |
| 13 |
%% this license or (at your option) any later version. The latest |
| 14 |
%% version of this license is in the file: |
| 15 |
%% |
| 16 |
%% https://www.latex-project.org/lppl.txt |
| 17 |
%% |
| 18 |
%% This file is part of the "LaTeX PDF management bundle" (The Work in LPPL) |
| 19 |
%% and all files in that bundle must be distributed together. |
| 20 |
%% |
| 21 |
%% File: l3backend-pdfmanagement.dtx |
| 22 |
\ProvidesExplFile |
| 23 |
{l3backend-pdf-dvips.def}{2026-05-26}{0.97c} |
| 24 |
{LaTeX~PDF~management~bundle~backend~support:~dvips} |
| 25 |
\cs_generate_variant:Nn \__kernel_backend_postscript:n { e } |
| 26 |
\cs_generate_variant:Nn \__pdf_backend_pdfmark:n { e } |
| 27 |
\cs_new_protected:Npn \__kernel_backend_shipout_literal:e #1 |
| 28 |
{ \tex_special:D~shipout { #1} } |
| 29 |
|
| 30 |
\cs_new_protected:Npn \__pdf_backend_record_abspage:n #1 |
| 31 |
{ |
| 32 |
\@bsphack |
| 33 |
\property_record:nn{#1}{abspage} |
| 34 |
\@esphack |
| 35 |
} |
| 36 |
\cs_new:Npn \__pdf_backend_ref_abspage:n #1 |
| 37 |
{ |
| 38 |
\property_ref:nn{#1}{abspage} |
| 39 |
} |
| 40 |
|
| 41 |
\cs_generate_variant:Nn \__pdf_backend_record_abspage:n {e} |
| 42 |
\cs_generate_variant:Nn \__pdf_backend_ref_abspage:n {e} |
| 43 |
\prop_new:N \g__pdf_tmpa_prop |
| 44 |
\tl_new:N \l__pdf_tmpa_tl |
| 45 |
\box_new:N \l__pdf_backend_tmpa_box |
| 46 |
\box_new:N \l__pdf_backend_tmpb_box |
| 47 |
|
| 48 |
\int_new:N \g__pdf_backend_resourceid_int |
| 49 |
\int_new:N \g__pdf_backend_name_int |
| 50 |
\int_new:N \g__pdf_backend_page_int |
| 51 |
\cs_new:Npn \__kernel_pdf_name_from_unicode_e:n #1 |
| 52 |
{ |
| 53 |
~ ( \text_expand:n { #1 } ) ~ cvn |
| 54 |
} |
| 55 |
\tl_gput_right:Nn\@kernel@after@shipout@lastpage |
| 56 |
{ |
| 57 |
\g__kernel_pdfmanagement_end_run_code_tl |
| 58 |
} |
| 59 |
\tl_if_exist:NTF \@kernel@after@shipout@background |
| 60 |
{ |
| 61 |
\g@addto@macro \@kernel@before@shipout@background{\relax} |
| 62 |
\g@addto@macro \@kernel@after@shipout@background |
| 63 |
{ |
| 64 |
\g__kernel_pdfmanagement_thispage_shipout_code_tl |
| 65 |
} |
| 66 |
} |
| 67 |
{ |
| 68 |
\hook_gput_code:nnn{shipout/background}{pdf} |
| 69 |
{ |
| 70 |
\g__kernel_pdfmanagement_thispage_shipout_code_tl |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
\cs_new_protected:Npx \__pdf_backend_Pages_primitive:n #1 |
| 75 |
{ |
| 76 |
\tex_special:D{ps:~[#1~/PAGES~pdfmark} %] |
| 77 |
} |
| 78 |
\cs_new_protected:Npn \__pdf_backend_Page_primitive:n #1 |
| 79 |
{ |
| 80 |
\tex_special:D{ps:~[{ThisPage}<<#1>>~/PUT~pdfmark} %] |
| 81 |
} |
| 82 |
% the command to store default values. |
| 83 |
% Uses a prop with pdflatex + dvi, |
| 84 |
% sets a lua table with lualatex |
| 85 |
\cs_new_protected:Npn \__pdf_backend_Page_gput:nn #1 #2 |
| 86 |
{ |
| 87 |
\pdfdict_gput:nnn {g__pdf_Core/Page}{ #1 }{ #2 } |
| 88 |
} |
| 89 |
% the command to remove a default value. |
| 90 |
% Uses a prop with pdflatex + dvi, |
| 91 |
% changes a lua table with lualatex |
| 92 |
\cs_new_protected:Npn \__pdf_backend_Page_gremove:n #1 |
| 93 |
{ |
| 94 |
\pdfdict_gremove:nn {g__pdf_Core/Page}{ #1 } |
| 95 |
} |
| 96 |
% the command used in the document. |
| 97 |
% direct call of the primitive special with dvips/dvipdfmx |
| 98 |
% \latelua: fill a page related table with lualatex, merge it with the page |
| 99 |
% table and push it directly |
| 100 |
% write to aux and store in prop with pdflatex |
| 101 |
\cs_new_protected:Npn \__pdf_backend_ThisPage_gput:nn #1 #2 |
| 102 |
{ |
| 103 |
\__pdf_backend_Page_primitive:n { /#1~#2 } |
| 104 |
} |
| 105 |
%the code to push the values, used in shipout |
| 106 |
%merges the two props and then fills the register in pdflatex |
| 107 |
%merges the two tables (the one is probably still empty) |
| 108 |
%and then fills (in lua) in luatex |
| 109 |
%issues the values stored in the global prop with dvi |
| 110 |
\cs_new_protected:Npn \__pdf_backend_ThisPage_gpush:n #1 |
| 111 |
{ |
| 112 |
\__pdf_backend_Page_primitive:e |
| 113 |
{ \pdfdict_use:n { g__pdf_Core/Page} } |
| 114 |
} |
| 115 |
\cs_generate_variant:Nn \__pdf_backend_Page_primitive:n { e } |
| 116 |
\clist_const:Nn \c__pdf_backend_PageResources_clist |
| 117 |
{ |
| 118 |
ExtGState, |
| 119 |
ColorSpace, |
| 120 |
Pattern, |
| 121 |
Shading, |
| 122 |
} |
| 123 |
\cs_new_protected:Npn \__pdf_backend_PageResources:n #1 {} |
| 124 |
\cs_new_protected:Npn \__pdf_backend_PageResources_gput:nnn #1 #2 #3 |
| 125 |
{ %only for the show command TEST!! |
| 126 |
\pdfdict_gput:nnn {g__pdf_Core/Page/Resources/#1} { #2 }{ #3 } |
| 127 |
} |
| 128 |
\cs_new_protected:Npn \__pdf_backend_PageResources_obj_gpush: {} |
| 129 |
\bool_new:N \l__pdf_backend_xform_bool |
| 130 |
\cs_set_protected:Npn \__pdf_backend_bdc:nn #1 #2 % #1 eg. Span, #2: dict_content |
| 131 |
{ |
| 132 |
\__pdf_backend_pdfmark:n{/#1~<<#2>>~/BDC} |
| 133 |
} |
| 134 |
\cs_set_eq:NN \__pdf_backend_bdc_contobj:nn \__pdf_backend_bdc:nn |
| 135 |
\cs_set_eq:NN \__pdf_backend_bdc_contstream:nn \__pdf_backend_bdc:nn |
| 136 |
|
| 137 |
\cs_new_protected:Npn \__pdf_backend_bdc_shipout:ee #1 #2 % #1 eg. Span, #2: dict_content |
| 138 |
{ |
| 139 |
\__kernel_backend_shipout_literal:e |
| 140 |
{ps: SDict ~ begin ~ mark /#1~<<#2>>~/BDC ~ pdfmark ~ end } |
| 141 |
} |
| 142 |
|
| 143 |
\cs_set_protected:Npn \__pdf_backend_bdcobject:nn #1 #2 % #1 eg. Span, #2: object name |
| 144 |
{ |
| 145 |
\__pdf_backend_pdfmark:e{/#1~\pdf_object_ref:n{#2}~/BDC} |
| 146 |
} |
| 147 |
\cs_set_protected:Npn \__pdf_backend_bdcobject:n #1 % #1 eg. Span, |
| 148 |
{ |
| 149 |
\__pdf_backend_pdfmark:e{/#1~\__pdf_backend_object_last:~/BDC} |
| 150 |
} |
| 151 |
\cs_set_protected:Npn \__pdf_backend_emc: |
| 152 |
{ |
| 153 |
\__pdf_backend_pdfmark:n{/EMC} % |
| 154 |
} |
| 155 |
\cs_set_protected:Npn \__pdf_backend_bmc:n #1 |
| 156 |
{ |
| 157 |
\__pdf_backend_pdfmark:n{/#1~/BMC} % |
| 158 |
} |
| 159 |
\cs_new_protected:Npn \__pdf_backend_PageResources_gpush:n #1 {} |
| 160 |
|
| 161 |
|
| 162 |
\cs_new_protected:Npn \__pdf_backend_Names_gpush:nn #1 #2 {} |
| 163 |
\cs_new_protected:Npn \__pdf_backend_NamesEmbeddedFiles_add:nn #1 #2 |
| 164 |
{ |
| 165 |
\__pdf_backend_pdfmark:e |
| 166 |
{ |
| 167 |
/Name~#1~ |
| 168 |
/FS~#2~ |
| 169 |
/EMBED |
| 170 |
} |
| 171 |
} |
| 172 |
\tl_new:N \l__pdf_backend_xform_tmpwd_tl |
| 173 |
\tl_new:N \l__pdf_backend_xform_tmpdp_tl |
| 174 |
\tl_new:N \l__pdf_backend_xform_tmpht_tl |
| 175 |
\cs_new_protected:Npn\__pdf_backend_xform_new:nnnn #1 #2 #3 #4 % #1 name, #2 attribute, #4 content |
| 176 |
{ |
| 177 |
\int_gincr:N \g__pdf_backend_object_int |
| 178 |
\int_const:cn |
| 179 |
{ c__pdf_backend_xform_ \tl_to_str:n {#1} _int } |
| 180 |
{ \g__pdf_backend_object_int } |
| 181 |
|
| 182 |
\hbox_set:Nn \l__pdf_backend_tmpa_box |
| 183 |
{ |
| 184 |
\bool_set_true:N \l__pdf_backend_xform_bool |
| 185 |
\prop_gclear:c {\__kernel_pdfdict_name:n { g__pdf_Core/Xform/Resources/Properties }} |
| 186 |
#4 |
| 187 |
} |
| 188 |
%store the dimensions |
| 189 |
\tl_const:ce |
| 190 |
{ c__pdf_backend_xform_wd_ \tl_to_str:n {#1} _tl } |
| 191 |
{ \tex_the:D \box_wd:N \l__pdf_backend_tmpa_box } |
| 192 |
\tl_const:ce |
| 193 |
{ c__pdf_backend_xform_ht_ \tl_to_str:n {#1} _tl } |
| 194 |
{ \tex_the:D \box_ht:N \l__pdf_backend_tmpa_box } |
| 195 |
\tl_const:ce |
| 196 |
{ c__pdf_backend_xform_dp_ \tl_to_str:n {#1} _tl } |
| 197 |
{ \tex_the:D \box_dp:N \l__pdf_backend_tmpa_box } |
| 198 |
%store content dimensions in DPI units (Dots) (code from issue 25) |
| 199 |
\tl_set:Ne\l__pdf_backend_xform_tmpwd_tl |
| 200 |
{ |
| 201 |
\dim_to_decimal_in_sp:n{ \box_wd:N \l__pdf_backend_tmpa_box }~ |
| 202 |
65536~div~72.27~div~DVImag~mul~Resolution~mul~ |
| 203 |
} |
| 204 |
\tl_set:Ne\l__pdf_backend_xform_tmpht_tl |
| 205 |
{ |
| 206 |
\dim_to_decimal_in_sp:n{ \box_ht:N \l__pdf_backend_tmpa_box }~ |
| 207 |
65536~div~72.27~div~DVImag~mul~VResolution~mul~ |
| 208 |
} |
| 209 |
\tl_set:Ne\l__pdf_backend_xform_tmpdp_tl |
| 210 |
{ |
| 211 |
\dim_to_decimal_in_sp:n{ \box_dp:N \l__pdf_backend_tmpa_box }~ |
| 212 |
65536~div~72.27~div~DVImag~mul~VResolution~mul~ |
| 213 |
} |
| 214 |
% mirror the box |
| 215 |
%\box_scale:Nnn \l__pdf_backend_tmpa_box {1} {-1} |
| 216 |
\hbox_set:Nn\l__pdf_backend_tmpb_box |
| 217 |
{ |
| 218 |
\__kernel_backend_postscript:e |
| 219 |
{ |
| 220 |
gsave~currentpoint~ |
| 221 |
initclip~ % restore default clipping path (page device/whole page) |
| 222 |
clippath~pathbbox~newpath~pop~pop~ |
| 223 |
\tl_use:N\l__pdf_backend_xform_tmpdp_tl~add~translate~ |
| 224 |
mark~ |
| 225 |
/_objdef~{ pdf.obj \int_use:N\g__pdf_backend_object_int }\c_space_tl~ |
| 226 |
/BBox[ |
| 227 |
0~ |
| 228 |
\tl_use:N\l__pdf_backend_xform_tmpht_tl~ |
| 229 |
\tl_use:N\l__pdf_backend_xform_tmpwd_tl~ |
| 230 |
\tl_use:N\l__pdf_backend_xform_tmpdp_tl~ |
| 231 |
neg |
| 232 |
] |
| 233 |
\str_if_eq:eeF{#1}{} |
| 234 |
{ |
| 235 |
product~(Distiller)~search~{pop~pop~pop~#2}{pop}ifelse~ |
| 236 |
} |
| 237 |
/BP~pdfmark~1~-1~scale~neg~exch~neg~exch~translate |
| 238 |
} |
| 239 |
\box_use_drop:N\l__pdf_backend_tmpa_box |
| 240 |
\__kernel_backend_postscript:n |
| 241 |
{ |
| 242 |
mark ~ /EP~pdfmark ~ grestore |
| 243 |
} |
| 244 |
\str_if_eq:eeF{#1}{} |
| 245 |
{ |
| 246 |
\__kernel_backend_postscript:e |
| 247 |
{ |
| 248 |
product~(Ghostscript)~search~ |
| 249 |
{ |
| 250 |
pop~pop~pop~ |
| 251 |
mark~ |
| 252 |
{ pdf.obj \int_use:c{c__pdf_backend_xform_ \tl_to_str:n {#1} _int} } |
| 253 |
~<<#2>>~/PUT~pdfmark |
| 254 |
}{pop}ifelse |
| 255 |
} |
| 256 |
} |
| 257 |
} |
| 258 |
\box_set_dp:Nn \l__pdf_backend_tmpb_box { \c_zero_dim } |
| 259 |
\box_set_ht:Nn \l__pdf_backend_tmpb_box { \c_zero_dim } |
| 260 |
\box_set_wd:Nn \l__pdf_backend_tmpb_box { \c_zero_dim } |
| 261 |
\hook_gput_code:nnn {begindocument/end}{pdfxform} |
| 262 |
{ |
| 263 |
\mode_leave_vertical: |
| 264 |
\box_use:N\l__pdf_backend_tmpb_box |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
\cs_new_protected:Npn \__pdf_backend_xform_use:n #1 |
| 269 |
{ |
| 270 |
\hbox_set:Nn \l__pdf_backend_tmpa_box |
| 271 |
{ |
| 272 |
\__kernel_backend_postscript:e |
| 273 |
{ |
| 274 |
gsave~currentpoint~translate~1~-1~scale~ |
| 275 |
mark~{ pdf.obj \int_use:c{c__pdf_backend_xform_ \tl_to_str:n {#1} _int }}~ |
| 276 |
/SP~pdfmark ~ grestore |
| 277 |
} |
| 278 |
} |
| 279 |
\box_set_wd:Nn \l__pdf_backend_tmpa_box { \pdfxform_wd:n { #1 } } |
| 280 |
\box_set_ht:Nn \l__pdf_backend_tmpa_box { \pdfxform_ht:n { #1 } } |
| 281 |
\box_set_dp:Nn \l__pdf_backend_tmpa_box { \pdfxform_dp:n { #1 } } |
| 282 |
\box_use_drop:N \l__pdf_backend_tmpa_box |
| 283 |
} |
| 284 |
\cs_new:Npn \__pdf_backend_xform_ref:n #1 |
| 285 |
{ |
| 286 |
{ pdf.obj \int_use:c{c__pdf_backend_xform_ \tl_to_str:n {#1} _int} } |
| 287 |
} |
| 288 |
|
| 289 |
%% all |
| 290 |
\prg_new_conditional:Npnn \__pdf_backend_xform_if_exist:n #1 { p , T , F , TF } |
| 291 |
{ |
| 292 |
\int_if_exist:cTF { c__pdf_backend_xform_ \tl_to_str:n {#1} _int } |
| 293 |
{ \prg_return_true: } |
| 294 |
{ \prg_return_false:} |
| 295 |
} |
| 296 |
\prg_new_eq_conditional:NNn \pdfxform_if_exist:n\__pdf_backend_xform_if_exist:n |
| 297 |
{ TF , T , F , p } |
| 298 |
\tl_new:N \l_pdf_current_structure_destination_tl |
| 299 |
\cs_new_protected:Npn \pdf_activate_structure_destination: |
| 300 |
{ |
| 301 |
\cs_gset_eq:NN \__pdf_backend_destination:nn \__pdf_backend_structure_destination:nn |
| 302 |
\cs_gset_eq:NN \__pdf_backend_destination:nnnn \__pdf_backend_structure_destination:nnnn |
| 303 |
\cs_gset_eq:NN \__pdfannot_backend_link_begin_goto:nnw \__pdfannot_backend_link_begin_structure_goto:nnw |
| 304 |
} |
| 305 |
\cs_new_protected:Npn \pdf_activate_indexed_structure_destination: |
| 306 |
{ |
| 307 |
\cs_gset_eq:NN \__pdf_backend_destination:nn \__pdf_backend_indexed_structure_destination:nn |
| 308 |
\cs_gset_eq:NN \__pdf_backend_destination:nnnn \__pdf_backend_indexed_structure_destination:nnnn |
| 309 |
\cs_gset_eq:NN \__pdfannot_backend_link_begin_goto:nnw \__pdfannot_backend_link_begin_structure_goto:nnw |
| 310 |
} |
| 311 |
\cs_set_eq:NN \__pdf_backend_structure_destination:nn \__pdf_backend_destination:nn |
| 312 |
\cs_set_eq:NN \__pdf_backend_structure_destination:nnnn \__pdf_backend_destination:nnnn |
| 313 |
\cs_set_eq:NN \__pdfannot_backend_link_begin_structure_goto:nnw \__pdfannot_backend_link_begin_goto:nnw |
| 314 |
\cs_set_eq:NN \__pdf_backend_indexed_structure_destination:nn \__pdf_backend_destination:nn |
| 315 |
\cs_set_eq:NN \__pdf_backend_indexed_structure_destination:nnnn \__pdf_backend_destination:nnnn |
| 316 |
\cs_new_protected:Npn \__pdf_backend_set_regression_data: |
| 317 |
{ |
| 318 |
\sys_gset_rand_seed:n{1000} |
| 319 |
\pdfmanagement_add:nnn{Info}{Creator}{(TeX)} |
| 320 |
\AddToHook{begindocument}{\pdfmanagement_add:nnn{Info}{Producer}{(pdfTeX+dvips)}} |
| 321 |
\__kernel_backend_literal:e{!~<</DocumentUUID~(DocumentUUID)>>~setpagedevice} |
| 322 |
\__kernel_backend_literal:e{!~<</InstanceUUID~(InstanceUUID)>>~setpagedevice} |
| 323 |
\pdfmanagement_add:nne{Info}{CreationDate}{(\c_sys_timestamp_str)} |
| 324 |
\pdfmanagement_add:nne{Info}{ModDate}{(\c_sys_timestamp_str)} |
| 325 |
\pdfdict_put:nne {l_pdffile/Params} {ModDate}{(\c_sys_timestamp_str)} |
| 326 |
\AddToDocumentProperties[hyperref]{pdfinstanceid}{uuid:0a57c455-157a-4141-8c19-6237d832fc80} |
| 327 |
\AddToDocumentProperties[hyperref]{pdfproducer}{\c_sys_engine_exec_str-NN.NN.NN} |
| 328 |
} |
| 329 |
\cs_new_protected:Npn \__pdf_backend_metadata_stream:n #1 |
| 330 |
{ |
| 331 |
\pdf_object_write:nnn{__pdfmeta/xmp} {stream}{{/Type~/Metadata~/Subtype~/XML}{#1}} |
| 332 |
} |
| 333 |
\cs_new_protected:Npn \__pdf_backend_omit_charset:n #1 {} %#1 number |
| 334 |
\cs_new_protected:Npn \__pdf_backend_omit_info:n #1 {} %#1 number |
| 335 |
\cs_new_protected:Npn \__pdf_backend_omit_cidset:n #1 {} %#1 number |
| 336 |
\cs_new_protected:Npn \__pdf_backend_action:nnnnnnn #1#2#3#4#5#6#7 |
| 337 |
{ |
| 338 |
\__pdf_backend_pdfmark:e |
| 339 |
{ |
| 340 |
/Title~(\exp_not:n{#7})~ |
| 341 |
/Count~\bool_if:nF{#3}{-}#2~ |
| 342 |
\tl_if_blank:nF { #4 }{/C~[#4]} |
| 343 |
/F~#5 |
| 344 |
/Action <<\exp_not:n{#6}>> |
| 345 |
/OUT |
| 346 |
} |
| 347 |
} |
| 348 |
\cs_new_protected:Npn \__pdf_backend_goto:nnnnnnn #1#2#3#4#5#6#7 |
| 349 |
{ |
| 350 |
\__pdf_backend_pdfmark:e |
| 351 |
{ |
| 352 |
/Title~(\exp_not:n{#7})~ |
| 353 |
/Count~\bool_if:nF{#3}{-}#2~ |
| 354 |
\tl_if_blank:nF { #4 }{/C~[#4]} |
| 355 |
/F~#5 |
| 356 |
/Action/GoTo/Dest(\exp_not:n{#6})~cvn |
| 357 |
/OUT |
| 358 |
} |
| 359 |
} |
| 360 |
%% |
| 361 |
%% |
| 362 |
%% End of file `l3backend-pdf-dvips.def'. |