Debian Codegraph @

texmf-dist/tex/latex/pdfmanagement/hgeneric.def

raw
1 %%
2 %% This is file `hgeneric.def',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% hyperref-generic.dtx (with options: `header,package')
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: hyperref-generic.dtx
22
23 \ProvidesFile{hgeneric.def}[2026-05-26 v0.97c %
24 generic Hyperref driver for the LaTeX PDF management bundle]
25 \RequirePackage{etoolbox} %why?
26 \long\def\Hy@ReturnAfterFi#1\fi{\fi#1}
27 \ExplSyntaxOn
28 \file_input:n {hyperref-colorschemes.def}
29 \ExplSyntaxOff
30 \ExplSyntaxOn
31 \prop_gput:Nnn \g_msg_module_name_prop { hyp }{ hyperref }
32 \msg_new:nnnn
33 { hyp }
34 { missing-resource-management }
35 { The~PDF~resource~management~is~required~for~this~hyperref~driver! }
36 {
37 Activate~it~with \\
38 \tl_to_str:n{\DocumentMetadata{<options>}}\\
39 before~\tl_to_str:n{\documentclass} or \\
40 \RequirePackage{pdfmanagement}
41 }
42 \msg_new:nnnn
43 { hyp }
44 { pdfversion-disabled }
45 {
46 This~hyperref~driver~ignores~the~pdfversion~key!\\
47 Set~the~pdfversion~in~\token_to_str:N \DocumentMetadata\\or
48 with \tl_to_str:n{\SetKeys[document/metadata]}
49 }
50 {
51 For example:\\
52 \tl_to_str:n
53 {
54 \DocumentMetadata { pdfversion=1.7 }
55 }
56 }
57 \msg_new:nnn
58 { hyp }
59 { key-dropped }
60 {
61 This~hyperref~driver~ignores~the~key~#1!\\
62 Please~check~the~documentation.
63 }
64 \msg_new:nnn
65 { hyp }
66 { pdfa-no-push-button }
67 { PDF/A:~Push~button~with~JavaScript~is~prohibited }
68
69 \msg_new:nnn
70 { hyp }
71 { pdfa-no-reset-button }
72 { PDF/A:~Reset~action~is~prohibited }
73 \msg_new:nnn
74 { hyp }
75 { pdfa-no-named-action }
76 { PDF/A:~Named~action~#1~is~prohibited }
77 \msg_new:nnn
78 { hyp }
79 { empty-destination-name }
80 {
81 Empty~destination~name,\\
82 using~'#1'
83 }
84 \msg_new:nnn
85 { hyp }
86 { invalid-destination-value }
87 {
88 Invalid~value~'#1'~of~'#2' \\
89 is~replaced~by~'Fit'~\msg_line_context:.
90 }
91 \msg_new:nnn
92 { hyp }
93 { ignore-deprecated-or-unknown-option-in-pdf-version }
94 {
95 Option~'#1'~is~unknown~or~deprecated~in\\
96 pdf~version~#2.~Ignored.
97 }
98 \msg_new:nnn
99 { hyp }
100 { ignore-deprecated-or-unknown-value-in-pdf-version }
101 {
102 Value~'#1'~is~unknown~or~deprecated~in\\
103 pdf~version~#2.~Ignored.
104 }
105 \msg_new:nnn
106 { hyp }
107 { replace-deprecated-or-unknown-value-in-pdf-version }
108 {
109 Value~'#1'~is~unknown~or~deprecated~in\\
110 pdf~version~#2. Value~'#3'~is used instead.
111 }
112 \msg_new:nnn
113 { hyp }
114 { unknown-key }
115 {
116 unknown~key~#2~of~module~'#1'~set~to~'#3'.
117 }
118 \msg_new:nnn
119 { hyp }
120 { unknown-key-to-Hyp }
121 {
122 ignored~in~family~Hyp~unknown~key~#1.
123 }
124 \cs_new:Npn \__hyp_clist_display:n #1 {*~#1\\}
125 \msg_new:nnn
126 { hyp }
127 { unknown-choice }
128 {
129 Value~'#3'~is~invalid~for~key~'#1'.\\
130 The~key~accepts~only~the~choices\\
131 \clist_map_function:nN { #2 }\__hyp_clist_display:n
132 }
133
134 \msg_new:nnn
135 { hyp }
136 { unknown-choice+empty }
137 {
138 Value~'#3'~is~invalid~for~key~'#1'.\\
139 The~key~accepts~only~the~choices\\
140 \clist_map_function:nN { #2 }\__hyp_clist_display:n
141 An~empty~value~removes~the~setting.
142 }
143
144 \msg_new:nnn
145 { hyp }
146 { no-bool }
147 {
148 Value~'#2'~is~invalid~for~key~'#1'.\\
149 The~key~accepts~only~the~choices\\
150 *~true\\
151 *~false \\
152 *~and~an~empty~value~which~removes~the~setting.\\
153 No~value~is~equivalent~to~using~'true'.
154 }
155 \msg_new:nnn
156 { hyp }
157 { empty-info-value }
158 {
159 Empty~value~for~key~#1.\\
160 This~isn't~honored~by~all~backends.
161 }
162 \cs_generate_variant:Nn\pdf_destination:nn {nf}
163 \cs_generate_variant:Nn\pdf_object_ref:n {e}
164 \cs_generate_variant:Nn\pdf_pageobject_ref:n {e}
165 \chardef\Hy@VersionChecked=1 %don't check the version!
166 \cs_set_eq:NN \hypercalcbp \dim_to_decimal_in_bp:n
167 \providecommand\@pdfborder{}
168 \providecommand\@pdfborderstyle{}
169 \newcommand\OBJ@OCG@view {} % needed in hyperref
170 \def\Hy@numberline#1{#1\c_space_tl} %needed by bookmark
171 \cs_set_eq:NN \Hy@pdfminorversion \pdf_version_minor:
172 \cs_set_eq:NN \Hy@pdfmajorversion \pdf_version_major:
173 \legacy_if:nT { Hy@setpdfversion }
174 {
175 \msg_warning:nn { hyp }{ pdfversion-disabled }
176 }
177 \Hy@DisableOption{pdfversion}
178 \RenewDocumentCommand \Acrobatmenu { m m }
179 {
180 \hyper@linknamed {#1} {#2}
181 }
182 \cs_set_protected:Npn \hypersetup #1
183 {
184 %\kvsetkeys{Hyp} {#1}
185 \keys_set:nn { hyp }{ #1 }
186 }
187 \keys_define:nn { hyp }
188 {
189 unknown .code:n =
190 {
191 \msg_warning:nneee { hyp } { unknown-key }
192 { hyp }{ \l_keys_key_str } { #1 }
193 }
194 }
195 \keys_define:nn { hyp }
196 {
197 next-anchor .code:n =
198 {
199 \AddToHookNext{__hyp/dest/make}
200 {\Hy@MakeCurrentHref{#1}}
201 }
202 }
203
204 \bool_new:N \l__hyp_href_url_encode_bool
205 \bool_new:N \l__hyp_href_url_ismap_bool
206 \tl_new:N \l__hyp_href_url_protocol_tl
207 \tl_new:N \l__hyp_href_pdf_destination_tl
208 \tl_new:N \l__hyp_href_pdf_page_tl
209 \tl_new:N \l__hyp_href_run_parameter_tl
210 \cs_new_protected:Npn \__hyp_href_url_format: {\begingroup\Url}
211
212 \keys_define:nn { hyp / href }
213 {
214 ,urlencode .bool_set:N = \l__hyp_href_url_encode_bool
215 ,format .code:n = { \cs_set:Nn \__hyp_href_url_format: {#1} },
216 ,protocol .tl_set:N = \l__hyp_href_url_protocol_tl
217 ,destination .tl_set:N = \l__hyp_href_pdf_destination_tl
218 ,pdfremotestartview .code:n =
219 {
220 \keys_set:nn { hyp }
221 { pdfremotestartview = #1 }
222 }
223 ,page .code:n =
224 {
225 \tl_set:Nn \l__hyp_href_pdf_page_tl {#1}
226 \tl_set:Nn \Hy@href@page {#1}
227 }
228 ,ismap .bool_set:N = \l__hyp_href_url_ismap_bool
229 ,run-parameter .tl_set:N = \l__hyp_href_run_parameter_tl
230 ,nextactionraw .code:n =
231 { %perhaps some safety match later, see hyperref code
232 \tl_if_empty:nTF {#1}
233 {
234 \pdfdict_remove:nn{l_hyp/annot/A}{Next}
235 }
236 {
237 \pdfdict_put:nnn{l_hyp/annot/A}{Next}{#1}
238 \tl_set:Nn \Hy@href@nextactionraw {/Next~#1}
239 \keys_set:nn {hyp }{ pdfnewwindow = true}
240 }
241 }
242 ,afrelationship .code:n =
243 {
244 \pdfdict_put:nne
245 { l_pdffile/Filespec}{AFRelationship}{ \pdf_name_from_unicode_e:n {#1}}
246 }
247
248 }
249
250 \keys_define:nn { hyp }
251 {
252 ,href / urlencode .bool_set:N = \l__hyp_href_url_encode_bool
253 ,href / urlencode .default:n = {true}
254 ,href / urlencode .initial:n = {false}
255 ,href / protocol .tl_set:N = \l__hyp_href_url_protocol_tl
256 ,href / destination .tl_set:N = \l__hyp_href_pdf_destination_tl
257 ,href / format .code:n = { \cs_set:Nn \__hyp_href_url_format:{#1} }
258 }
259
260 \hook_new_pair:nn{cmd/href/before}{cmd/href/after}
261
262 \DeclareRobustCommand*{\href}[1][]{%
263 \mode_leave_vertical:
264 \hook_use:n{cmd/href/before}
265 \group_begin:
266 \keys_set:nn { hyp / href } {#1}
267 \bool_if:NTF \l__hyp_href_url_encode_bool
268 {
269 \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/URI}
270 }
271 {
272 \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string}
273 }
274 \@ifnextchar\bgroup\Hy@href{\hyper@normalise\href@}%
275 }
276
277 \begingroup
278 \catcode`\$=6 %
279 \catcode`\#=12 %
280 \gdef\href@$1{\expandafter\href@split$1##\\}%
281 \gdef\href@split$1#$2#$3\\$4{%
282 \hyper@@link{$1}{$2}{$4}%<---__hyp-docstrip doubling!
283 \endgroup
284 \hook_use:n{cmd/href/after}
285 }%
286 \endgroup
287
288 \hook_new_pair:nn{cmd/hrefurl/before}{cmd/hrefurl/after}
289
290 \DeclareRobustCommand*{\hrefurl}[1][]
291 {
292 \mode_leave_vertical:
293 \hook_use:n{cmd/href/before}
294 \group_begin:
295 \keys_set:nn { hyp / href } {#1}
296 \bool_if:NTF \l__hyp_href_url_encode_bool
297 {
298 \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/URI}
299 }
300 {
301 \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string}
302 }
303 \hyper@normalise\__hyp_href_url_aux:nn}
304
305 \cs_new_protected:Npn \__hyp_href_url_aux:nn #1 #2
306 {
307 \exp_args:Nno\hyper@linkurl{#2}{\l__hyp_href_url_protocol_tl#1}
308 \group_end:
309 \hook_use:n{cmd/href/after}
310 }
311
312 \hook_new_pair:nn{cmd/hrefpdf/before}{cmd/hrefpdf/after}
313 \DeclareRobustCommand*{\hrefpdf}[1][]
314 {
315 \mode_leave_vertical:
316 \hook_use:n{cmd/hrefpdf/before}
317 \group_begin:
318 \keys_set:nn { hyp / href } {#1}
319 \hyper@normalise\__hyp_href_pdf_aux:nn
320 }
321
322 \cs_new_protected:Npn \__hyp_href_pdf_aux:nn #1 #2
323 {
324 \exp_args:Nnno\hyper@linkfile{#2}{#1}{\l__hyp_href_pdf_destination_tl}
325 \group_end:
326 \hook_use:n{cmd/hrefpdf/after}
327 }
328
329 \hook_new_pair:nn{cmd/hrefrun/before}{cmd/hrefrun/after}
330 \DeclareRobustCommand*{\hrefrun}[1][]
331 {
332 \mode_leave_vertical:
333 \hook_use:n{cmd/hrefrun/before}
334 \group_begin:
335 \keys_set:nn { hyp / href } {#1}
336 \hyper@normalise\__hyp_href_run_aux:nn
337 }
338
339 \cs_new_protected:Npn \__hyp_href_run_aux:nn #1 #2
340 {
341 \exp_args:Nnno\hyper@linklaunch{#1}{#2}{\l__hyp_href_run_parameter_tl}
342 \group_end:
343 \hook_use:n{cmd/hrefrun/after}
344 }
345
346 \hook_new_pair:nn{cmd/url/before}{cmd/url/after}
347
348 \DeclareRobustCommand*{\url}[1][]
349 {
350 \mode_leave_vertical:
351 \hook_use:n{cmd/url/before}
352 \group_begin:
353 \keys_set:nn {hyp / href } {#1}
354 \bool_if:NTF \l__hyp_href_url_encode_bool
355 {
356 \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/URI}
357 }
358 {
359 \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/string}
360 }
361 \hyper@normalise\__hyp_href_url_aux:n
362 }
363
364 \cs_new_protected:Npn \__hyp_href_url_aux:n #1
365 {
366 \exp_args:Nno
367 \hyper@linkurl{\__hyp_href_url_format: {#1}}
368 {\l__hyp_href_url_protocol_tl#1}
369 \group_end:
370 \hook_use:n{cmd/url/after}
371 }
372
373
374 \def\urldef#1#2{\begingroup\def\url{\hyper@normalise\url@}\setbox\z@\hbox\bgroup
375 \def\Url@HyperHook##1\endgroup{\Url@def{#1}{#2}}%
376 % Because hyperref breaks \urldef and does not define its own (Grrrr!)...
377 \def\url@##1{\egroup\endgroup\DeclareRobustCommand#1{#2{##1}}}%
378 #2}
379
380 \NewExpandableDocumentCommand\__hyp_secondoftwowithopt:wnn {omm}{#3}
381 \pdfstringdefDisableCommands{\let\hrefurl\__hyp_secondoftwowithopt:wnn}
382 \pdfstringdefDisableCommands{\let\hrefpdf\__hyp_secondoftwowithopt:wnn}
383 \pdfstringdefDisableCommands{\let\hrefrun\__hyp_secondoftwowithopt:wnn}
384 \cs_new_protected:Npn \__hyp_store_metadata:nn #1 #2 %#1 key, #2 value.
385 {
386 %\tl_set:cn {@#1}{#2}
387 \AddToDocumentProperties[hyperref]{#1}{#2}
388 }
389 \cs_generate_variant:Nn \__hyp_store_metadata:nn {en,ne,ee,no,eo}
390 \hook_new:n{hyp/link/cite}
391 \keys_define:nn { hyp }
392 {
393 ,citecolor .code:n = {\__hyp_color_set:ne {hyp/color/cite}{#1}\__hyp_citecolor_hook_init:}
394 ,citebordercolor
395 .code:n = {\__hyp_color_set:ne {hyp/color/citeborder}{#1}\__hyp_citebordercolor_hook_init:}
396 }
397 \cs_new_protected:Npn \__hyp_citecolor_hook_init:
398 {
399 \hook_gput_code:nnn { hyp/link/cite }{hyp/cite}
400 {
401 \keys_set:nn { hyp }
402 {
403 linkcolor = hyp/color/cite
404 }
405 }
406 \cs_gset_eq:NN \__hyp_citecolor_hook_init: \prg_do_nothing:
407 }
408 \cs_new_protected:Npn \__hyp_citebordercolor_hook_init:
409 {
410 \hook_gput_code:nnn { hyp/link/cite }{hyp/citeborder}
411 {
412 \keys_set:nn { hyp }
413 {
414 linkbordercolor = hyp/color/citeborder
415 }
416 }
417 \cs_gset_eq:NN \__hyp_citebordercolor_hook_init: \prg_do_nothing:
418 }
419
420 \bool_lazy_and:nnF
421 { \cs_if_exist_p:N \pdfmanagement_if_active_p: }{ \pdfmanagement_if_active_p: }
422 { \msg_error:nn { hyp}{ missing-resource-management } }
423 \AddToHook { package/bookmark/after }
424 {
425 \define@key{BKM}{color}
426 {
427 \tl_if_blank:nTF {#1}
428 { \cs_set_eq:NN\BKM@color\@empty }
429 {
430 \__hyp_color_set:ne {__hyp/tmpa}{#1}
431 \color_export:nVN
432 {__hyp/tmpa}
433 \g__hyp_bordercolormodel_str
434 \BKM@color
435 }
436 }
437 }
438 \legacy_if:nTF { Hy@bookmarks }
439 {
440 \legacy_if:nT {Hy@draft}
441 {
442 \PassOptionsToPackage{draft}{bookmark}
443 }
444 \RequirePackage{bookmark}
445 }
446 {
447 \providecommand\bookmarksetup[1]{}
448 \AddToHook{file/bookmark.sty/before}{\let\bookmarksetup\undefined}
449 }
450 \cs_new_protected:Npn \__hyp_property_record:nn #1 #2 %label/attributes
451 {
452 \@bsphack
453 \property_record:nn{#1}{#2}
454 \@esphack
455 }
456 \cs_generate_variant:Nn \__hyp_property_record:nn {ee}
457 \box_new:N \l__hyp_tmpa_box
458 \tl_new:N \l__hyp_tmpa_tl
459 \tl_new:N \l__hyp_tmpb_tl
460 \seq_new:N \l__hyp_tmpa_seq
461 \int_new:N \l__hyp_tmpa_int
462 \str_new:N \l__hyp_tmpa_str
463 \tl_new:N \l__hyp_dest_name_tmpa_tl
464 \tl_new:N \l__hyp_uri_tmpa_tl
465 \tl_new:N \l__hyp_filename_tmpa_tl
466 \tl_new:N \l__hyp_para_tmpa_tl
467 \str_new:N \l__hyp_text_tmpa_str
468 \str_new:N \g__hyp_text_tmpa_str
469 \tl_const:Nn \c__hyp_dest_undefined_tl {UNDEFINED}
470 \seq_const_from_clist:Nn \c__hyp_annot_types_seq
471 {url,link,file,menu,run}
472 \prop_const_from_keyval:Nn \c__hyp_map_annot_hyp_prop
473 {
474 URI = url,
475 GoTo = link,
476 GoToR = file,
477 Named = menu,
478 Launch= run
479 }
480 \prop_const_from_keyval:Nn \c__hyp_map_hyp_annot_prop
481 {
482 url = URI,
483 link = GoTo,
484 file = GoToR,
485 menu = Named,
486 run = Launch
487 }
488
489 \tl_new:N \g__hyp_dest_pdfstartpage_tl
490 \tl_new:N \g__hyp_dest_pdfstartview_tl
491 \tl_new:N \l__hyp_dest_pdfremotestartview_tl
492 \tl_new:N \l__hyp_text_enc_uri_print_tl
493 \tl_new:N \l__hyp_text_enc_info_print_tl
494 \tl_new:N \l__hyp_text_enc_dest_tl
495 \tl_new:N \l__hyp_text_enc_dest_print_tl
496 \tl_new:N \l__hyp_text_enc_file_print_tl
497 \tl_new:N \l__hyp_text_enc_para_print_tl
498
499 \tl_set:Nn \l__hyp_text_enc_uri_print_tl {utf8/URI}
500 \tl_set:Nn \l__hyp_text_enc_info_print_tl {utf16/hex}
501 \tl_set:Nn \l__hyp_text_enc_dest_tl {utf8/string-raw}
502 \tl_set:Nn \l__hyp_text_enc_dest_print_tl {utf8/string}
503 \tl_set:Nn \l__hyp_text_enc_file_print_tl {utf8/string}
504 \tl_set:Nn \l__hyp_text_enc_para_print_tl {utf8/string}
505 \tl_new:N\l__hyp_link_Contents_tl
506 \socket_new:nn {hyp/link/GoTo/Contents}{2}
507 \socket_new:nn {hyp/link/URI/Contents}{1}
508 \socket_new:nn {hyp/link/GoToR/Contents}{1}
509 \socket_assign_plug:nn{hyp/link/GoTo/Contents}{noop}
510 \socket_assign_plug:nn{hyp/link/GoToR/Contents}{noop}
511 \socket_assign_plug:nn{hyp/link/URI/Contents}{noop}
512 \socket_new_plug:nnn {hyp/link/GoTo/Contents}{default}
513 {
514 \__hyp_text_pdfstring:noN
515 { Go~to~destination~#1 }
516 { \l__hyp_text_enc_info_print_tl }
517 \l__hyp_link_Contents_tl
518 \pdfannot_dict_put:nne {link/GoTo}{Contents}
519 {\l__hyp_link_Contents_tl}
520 }
521 \socket_new_plug:nnn {hyp/link/GoToR/Contents}{default}
522 {
523 \__hyp_text_pdfstring:noN
524 { Open~file~#1 }
525 { \l__hyp_text_enc_info_print_tl }
526 \l__hyp_link_Contents_tl
527 \pdfannot_dict_put:nne {link/GoToR}{Contents}
528 {\l__hyp_link_Contents_tl}
529 }
530 \socket_new_plug:nnn {hyp/link/URI/Contents}{default}
531 {
532 \__hyp_text_pdfstring:noN
533 { #1 }
534 { \l__hyp_text_enc_info_print_tl }
535 \l__hyp_link_Contents_tl
536 \pdfannot_dict_put:nne {link/URI}{Contents}
537 {\l__hyp_link_Contents_tl}
538 }
539 \pdfmeta_standard_family:nn{UA}
540 {
541 \pdfmeta_standard_verify:nF{link_Contents}
542 {
543 \socket_assign_plug:nn{hyp/link/GoTo/Contents}{default}
544 \socket_assign_plug:nn{hyp/link/GoToR/Contents}{default}
545 \socket_assign_plug:nn{hyp/link/URI/Contents}{default}
546 }
547 }
548 \tl_new:N \l__hyp_dest_pdfview_tl
549 \str_new:N \g__hyp_bordercolormodel_str
550 \seq_map_inline:Nn \c__hyp_annot_types_seq
551 {
552 \bool_new:c {l_hyp_annot_color#1_bool}
553 }
554 \seq_map_inline:Nn \c__hyp_annot_types_seq
555 {
556 \bool_new:c {l_hyp_annot_ocgcolor#1_bool}
557 }
558 \seq_map_inline:Nn \c_pdfannot_link_types_seq
559 {
560 \bool_new:c {l__hyp_annot_#1_bool}
561 \bool_set_true:c {l__hyp_annot_#1_bool}
562 }
563 \box_new:N \l__hyp_dest_box
564
565 \regex_const:Nn \c__hyp_dest_startview_regex
566 {
567 \A\ *
568 (?:
569 (?:XYZ (?:\ +(?:(?:\d+|\d*\.\d+)|null)){3}\ )
570 |
571 (?:Fit\b|FitB\b)
572 |
573 (?:(?:FitH|FitV|FitBH|FitBV)(?:\ +(?:\d+|\d*\.\d+)|\ +null){1})
574 |
575 (?:FitR (?:\ +\d+|\ +\d*\.\d+){4}\ )
576 )
577 }
578 \pdfdict_new:n {l__hyp_page/Trans}
579 \pdfdict_put:nnn {l__hyp_page/Trans}{Type}{/Trans}
580
581 \cs_new_protected:Npn \__hyp_text_string_from_unicode:nN #1 #2
582 {
583 \pdf_string_from_unicode:nVN { #1 } #2 #2
584 }
585 \cs_new_protected:Npn \__hyp_text_pdfstring:nnN #1 #2 #3
586 {
587 \pdf_purify:nN {#1}#3
588 \pdf_string_from_unicode:nVN { #2 } #3 #3
589 }
590 \cs_generate_variant:Nn \__hyp_text_pdfstring:nnN {noN,eoN}
591
592 \cs_new_protected:Npn\Hy@pstringdef #1 #2
593 { \__hyp_text_pdfstring:nnN {#2} {utf8/string-raw}#1 }
594 \cs_new_protected:Npn \__hyp_text_pdfstring_info:nN #1 #2
595 {
596 \__hyp_text_pdfstring:noN { #1 }{ \l__hyp_text_enc_info_print_tl } #2
597 }
598 \cs_generate_variant:Nn \__hyp_text_pdfstring_info:nN {eN,oN}
599 \cs_new_protected:Npn\__hyp_PageLabels_gpush:
600 {
601 \pdfmanagement_add:nne {Catalog} {PageLabels}{<</Nums[\HyPL@Labels]>>}
602 }
603
604 \def\Hy@PutCatalog #1 {}
605
606 \legacy_if:nT { Hy@pdfpagelabels }
607 {
608 \cs_set_protected:Npn \HyPL@StorePageLabel #1
609 {
610 \tl_gput_right:Ne \HyPL@Labels { \the\Hy@abspage<<#1>> }
611 \__hyp_PageLabels_gpush:
612 }
613 }
614 \int_new:N \g__hyp_linknestlevel_int
615 \prg_new_conditional:Npnn \__hyp_if_outer_link: {TF}
616 {
617 \int_compare:nNnTF { \g__hyp_linknestlevel_int } > {1}
618 { \prg_return_false: }
619 { \prg_return_true: }
620 }
621
622 \cs_new:Npn \__hyp_check_link_nesting:TF #1 #2
623 {
624 \use_i:nn {#1}{#2}
625 }
626 \keys_define:nn { hyp }
627 {
628 nested-links .choice:,
629 nested-links / true .code:n =
630 { \cs_set_eq:NN \__hyp_check_link_nesting:TF \use_i:nn },
631 nested-links / false .code:n =
632 { \cs_set_eq:NN \__hyp_check_link_nesting:TF \__hyp_if_outer_link:TF },
633 nested-links .default:n = {true}
634 }
635 \Hy@WrapperDef \__hyp_destination:nn #1 #2
636 {
637 \mode_if_horizontal:T { \@savsf\spacefactor }
638 \Hy@SaveLastskip %defined in hyperref
639 \Hy@VerboseAnchor{#1} %defined in hyperref, for debugging
640 \__hyp_text_pdfstring:noN
641 { \HyperDestNameFilter{#1} }
642 { \l__hyp_text_enc_dest_tl }
643 \l__hyp_tmpa_tl
644 \str_if_eq:nnTF {#2} {fitrbox}
645 {
646 \exp_args:NV
647 \pdf_destination:nnnn \l__hyp_tmpa_tl
648 { \box_wd:N \l__hyp_dest_box }
649 { \box_ht:N \l__hyp_dest_box }
650 { \box_dp:N \l__hyp_dest_box }
651 }
652 {
653 \exp_args:NV
654 \pdf_destination:nf
655 { \l__hyp_tmpa_tl }
656 { #2 }
657 }
658 \Hy@RestoreLastskip %defined in hyperref
659 \mode_if_horizontal:T { \spacefactor\@savsf }
660 }
661 \tl_new:N\l_hyp_current_dest_name_tl
662 \hook_new:n{hyp/anchor}
663 \cs_new_protected:Npn \hyper@anchor #1
664 {
665 \exp_args:NnV
666 \__hyp_destination:nn {#1} \l__hyp_dest_pdfview_tl
667 \tl_set:Nn \l_hyp_current_dest_name_tl {#1}
668 \hook_use:n{hyp/anchor}
669 }
670
671 \cs_new_protected:Npn \hyper@anchorstart #1
672 {
673 \Hy@activeanchortrue
674 \exp_args:NnV
675 \__hyp_destination:nn {#1} \l__hyp_dest_pdfview_tl
676 \tl_set:Nn \l_hyp_current_dest_name_tl {#1}
677 \hook_use:n{hyp/anchor}
678 }
679
680 \cs_new_protected:Npn \hyper@anchorend
681 {
682 \Hy@activeanchorfalse
683 }
684 \cs_new_protected:Npn \__hyp_link_goto_begin:nw #1
685 {
686 \mode_leave_vertical:
687 \protected@edef \l__hyp_dest_name_tmpa_tl { #1 }
688 \tl_if_empty:NTF \l__hyp_dest_name_tmpa_tl
689 {
690 \msg_warning:nne
691 { hyp }
692 { empty-destination-name }
693 { \c__hyp_dest_undefined_tl }
694 \tl_set_eq:NN \l__hyp_dest_name_tmpa_tl \c__hyp_dest_undefined_tl
695 }
696 {
697 \__hyp_text_pdfstring:eoN
698 { \exp_args:No \HyperDestNameFilter { \l__hyp_dest_name_tmpa_tl } }
699 { \l__hyp_text_enc_dest_tl }
700 \l__hyp_dest_name_tmpa_tl
701 }
702 \exp_args:No
703 \pdfannot_link_goto_begin:nw { \l__hyp_dest_name_tmpa_tl }
704 }
705
706 \cs_new_protected:Npn \__hyp_link_goto_end:
707 {
708 \pdfannot_link_goto_end:
709 }
710
711 \cs_set_protected:Npn \hyper@link #1 #2 #3 %#1 context, #2=destination name, #3 content
712 {
713 \bool_if:NTF \l__hyp_annot_GoTo_bool
714 {
715 \int_gincr:N\g__hyp_linknestlevel_int
716 \__hyp_check_link_nesting:TF
717 {
718 \Hy@VerboseLinkStart{#1}{#2}
719 \group_begin:
720 \tl_set:Nn \l_hyp_current_dest_name_tl {#2}
721 \socket_use:nnn{hyp/link/GoTo/Contents}{#2}{#3}
722 \hook_use:n {hyp/link/#1}
723 \__hyp_link_goto_begin:nw {#2}#3\Hy@xspace@end
724 \__hyp_link_goto_end:
725 \group_end:
726 \Hy@VerboseLinkStop
727 }
728 {
729 \group_begin: #3\group_end:
730 }
731 \int_gdecr:N\g__hyp_linknestlevel_int
732 }
733 {{\let\protect\relax#3}}
734 }
735 \cs_set_protected:Npn \hyper@linkstart #1 #2 %#1 context, #2=destination name
736 {
737 \bool_if:NT \l__hyp_annot_GoTo_bool
738 {
739 \int_gincr:N\g__hyp_linknestlevel_int
740 \__hyp_check_link_nesting:TF
741 {
742 \Hy@VerboseLinkStart{#1}{#2}% only for debug
743 \group_begin:
744 \tl_set:Nn \l_hyp_current_dest_name_tl {#2}
745 \socket_use:nnn{hyp/link/GoTo/Contents}{#2}{}
746 \hook_use:n {hyp/link/#1}
747 \__hyp_link_goto_begin:nw {#2}
748 }
749 {
750 \group_begin:
751 }
752 }
753 }
754 \cs_set_protected:Npn \hyper@linkend
755 {
756 \bool_if:NT \l__hyp_annot_GoTo_bool
757 {
758 \__hyp_check_link_nesting:TF
759 {
760 \__hyp_link_goto_end:
761 \group_end:
762 \Hy@VerboseLinkStop
763 }
764 {
765 \group_end:
766 }
767 \int_gdecr:N\g__hyp_linknestlevel_int
768 }
769 }
770 \pdfdict_new:n {l_hyp/annot/A/URI}
771 \pdfdict_put:nnn {l_hyp/annot/A/URI}{Type}{/Action}
772 \pdfdict_put:nnn {l_hyp/annot/A/URI}{S}{/URI}
773
774 \cs_new_protected:Npn \hyper@linkurl #1 #2 %#1:link text #2: URI,
775 {
776 \bool_if:NTF \l__hyp_annot_URI_bool
777 {
778 \int_gincr:N\g__hyp_linknestlevel_int
779 \__hyp_check_link_nesting:TF
780 {
781 \group_begin:
782 \__hyp_text_pdfstring:noN {#2}{ \l__hyp_text_enc_uri_print_tl }\l__hyp_uri_tmpa_tl
783 \pdfdict_put:nno{l_hyp/annot/A/URI}{URI}{\l__hyp_uri_tmpa_tl}
784 \bool_if:NT \l__hyp_href_url_ismap_bool
785 {
786 \pdfdict_put:nnn{l_hyp/annot/A/URI}{IsMap}{true}
787 }
788 \socket_use:nn{hyp/link/URI/Contents}{#2}
789 \cs_set_eq:NN \# \c_hash_str
790 \cs_set_eq:NN \% \c_percent_str
791 \Hy@safe@activestrue
792 \mode_leave_vertical:
793 \pdfannot_dict_put:nne {link/URI}{A}{<<\pdfdict_use:n {l_hyp/annot/A/URI}>>}
794 \pdfannot_link:nen { URI }
795 {
796 }
797 {
798 \let\protect\relax
799 #1
800 \Hy@xspace@end
801 \Hy@VerboseLinkStop %where is the start??
802 }
803 \group_end:
804 }
805 {
806 \group_begin: #1 \group_end:
807 }
808 \int_gdecr:N\g__hyp_linknestlevel_int
809 }
810 {{\let\protect\relax#1}}
811 }
812
813 \pdfdict_new:n {l_hyp/annot/A/GoToR}
814 \pdfdict_put:nnn {l_hyp/annot/A/GoToR}{Type}{/Action}
815 \pdfdict_put:nnn {l_hyp/annot/A/GoToR}{S}{/GoToR}
816
817 \cs_generate_variant:Nn \pdffile_embed_file:nnn {noe}
818 \cs_new_protected:Npn \hyper@linkfile #1 #2 #3 % link text, filename, destname
819 {
820 \bool_if:NTF \l__hyp_annot_GoToR_bool
821 {
822 \int_gincr:N\g__hyp_linknestlevel_int
823 \__hyp_check_link_nesting:TF
824 {
825 \group_begin:
826 \tl_set:Ne \l__hyp_filename_tmpa_tl { \text_expand:n { #2 } }
827 \exp_args:Ne
828 \pdf_object_if_exist:nF { __hyp_file_\tl_to_str:N \l__hyp_filename_tmpa_tl }
829 {
830 \pdfdict_put:nne { l_pdffile/Filespec}{Subtype}{\pdf_name_from_unicode_e:n {application/pdf}}
831 \pdffile_embed_file:noe
832 {}
833 {\l__hyp_filename_tmpa_tl }
834 {__hyp_file_\tl_to_str:N \l__hyp_filename_tmpa_tl }
835 }
836 \pdfdict_put:nne
837 {l_hyp/annot/A/GoToR}
838 {F}
839 {\pdf_object_ref:e {__hyp_file_\tl_to_str:N \l__hyp_filename_tmpa_tl}}
840 \__hyp_text_pdfstring:noN
841 { #3 }
842 { \l__hyp_text_enc_dest_print_tl }
843 \l__hyp_dest_name_tmpa_tl
844 \socket_use:nn{hyp/link/GoToR/Contents}{#2}
845 \tl_if_blank:eTF {#3}
846 {
847 \pdfdict_put:nne {l_hyp/annot/A/GoToR}{D}
848 {
849 [
850 \int_eval:n
851 { \int_max:nn {0}{ 0\l__hyp_href_pdf_page_tl - 1 }}
852 /\l__hyp_dest_pdfremotestartview_tl
853 ]
854 }
855 }
856 {
857 \pdfdict_put:nno {l_hyp/annot/A/GoToR}{D}{\l__hyp_dest_name_tmpa_tl}
858 }
859 \mode_leave_vertical:
860 \pdf_object_unnamed_write:ne{dict}{\pdfdict_use:n {l_hyp/annot/A/GoToR}}
861 \pdfannot_dict_put:nne {link/GoToR}{A}{\pdf_object_ref_last:}
862 \pdfannot_link:nnn %expansion??
863 { GoToR }
864 {
865 }
866 {
867 \let\protect\relax
868 #1\Hy@xspace@end
869 \Hy@VerboseLinkStop %where is the start??
870 }
871 \group_end:
872 }
873 {
874 \group_begin: #1 \group_end:
875 }
876 \int_gdecr:N\g__hyp_linknestlevel_int
877 }
878 {{\let\protect\relax#1}}
879 }
880 \pdfdict_new:n {l_hyp/annot/A/Launch}
881 \pdfdict_put:nnn {l_hyp/annot/A/Launch}{Type}{/Action}
882 \pdfdict_put:nnn {l_hyp/annot/A/Launch}{S}{/Launch}
883
884 \cs_new_protected:Npn \hyper@linklaunch #1 #2 #3 % filename, link text, Parameters
885 {
886 \bool_if:NTF \l__hyp_annot_Launch_bool
887 {
888 \int_gincr:N\g__hyp_linknestlevel_int
889 \__hyp_check_link_nesting:TF
890 {
891 \group_begin:
892 \__hyp_text_pdfstring:noN
893 { #1 }
894 { \l__hyp_text_enc_file_print_tl }
895 \l__hyp_filename_tmpa_tl
896 \pdfdict_put:nno {l_hyp/annot/A/Launch}{F}{\l__hyp_filename_tmpa_tl}
897 \__hyp_text_pdfstring:noN
898 { #3 }
899 { \l__hyp_text_enc_para_print_tl }
900 \l__hyp_para_tmpa_tl
901 \bool_if:nTF
902 {
903 \str_if_eq_p:Vn \l__hyp_para_tmpa_tl {()}
904 ||
905 \pdf_version_compare_p:Nn > {1.9}
906 }
907 {
908 \pdfdict_remove:nn {l_hyp/annot/A/Launch}{Win}
909 }
910 {
911 \pdfdict_put:nne
912 {l_hyp/annot/A/Launch}
913 {Win}
914 {<</P \l__hyp_para_tmpa_tl /F \l__hyp_filename_tmpa_tl >>}
915 }
916 \mode_leave_vertical:
917 \pdfannot_dict_put:nne {link/Launch}{A}{<<\pdfdict_use:n {l_hyp/annot/A/Launch}>>}
918 \pdfannot_link:nen
919 { Launch }
920 {
921 % /A
922 % <<
923 % \pdfdict_use:n {l_hyp/annot/A/Launch}
924 % >>
925 }
926 {
927 \let\protect\relax
928 #2\Hy@xspace@end
929 \Hy@VerboseLinkStop %where is the start??
930 }
931 \group_end:
932 }
933 { \group_begin: #2 \group_end: }
934 \int_gdecr:N\g__hyp_linknestlevel_int
935 }
936 {{\let\protect\relax#2}}
937 }
938 \use:e
939 { % filename, anchor text, linkname
940 \cs_set_protected:Npn \exp_not:N \@hyper@launch run \c_colon_str #1 \exp_not:N \\ #2 #3
941 }
942 {
943 \hyper@linklaunch {#1}{#2}{#3}
944 }
945 \pdfdict_new:n {l_hyp/annot/A/Named}
946 \pdfdict_put:nnn {l_hyp/annot/A/Named}{Type}{/Action}
947 \pdfdict_put:nnn {l_hyp/annot/A/Named}{S}{/Named}
948
949 \cs_new_protected:Npn \hyper@linknamed #1 #2 %#1 action, #2 link text
950 {
951 \bool_if:NTF \l__hyp_annot_Named_bool
952 {
953 \int_gincr:N\g__hyp_linknestlevel_int
954 \__hyp_check_link_nesting:TF
955 {
956 \group_begin:
957 \pdfmeta_standard_verify:nnTF {named_actions}{#1}
958 {
959 \mode_leave_vertical:
960 \pdfdict_put:nne {l_hyp/annot/A/Named}{N}
961 {\pdf_name_from_unicode_e:n{#1}}
962 \pdfannot_dict_put:nne {link/Named}{A}{<<\pdfdict_use:n {l_hyp/annot/A/Named}>>}
963 \pdfannot_link:nnn { Named }
964 {
965 % /A
966 % <<
967 % \pdfdict_use:n { l_hyp/annot/A/Named }
968 % >>
969 }
970 {
971 #2
972 \Hy@xspace@end
973 \Hy@VerboseLinkStop
974 }
975 }
976 {
977 \msg_warning:nnn { hyp } { pdfa-no-named-action }{#1}
978 #2
979 }
980 \group_end:
981 }
982 { \group_begin: #2 \group_end: }
983 \int_gdecr:N\g__hyp_linknestlevel_int
984 }
985 {{\let\protect\relax#2}}
986 }
987
988 \cs_generate_variant:Nn \color_export:nnN {nVN}
989 \cs_new_protected:Npn \__hyp_color_select:n #1
990 {
991 \tl_if_head_eq_charcode:nNTF {#1}[ %]
992 {
993 \__hyp_color_select_aux:wn #1
994 }
995 {
996 \color_select:n {#1}
997 }
998 }
999
1000 \cs_new_protected:Npn \__hyp_color_select_aux:wn [#1] #2
1001 {
1002 \color_select:nn {#1}{#2}
1003 }
1004
1005 \cs_generate_variant:Nn \__hyp_color_select:n {e}
1006 \cs_new_protected:Npn \__hyp_color_set:nn #1 #2
1007 {
1008 \tl_if_head_eq_charcode:nNTF {#2}[ %]
1009 {
1010 \__hyp_color_set_aux:nwn { #1 } #2
1011 }
1012 {
1013 \color_set:nn {#1} {#2}
1014 }
1015 }
1016
1017 \cs_new_protected:Npn \__hyp_color_set_aux:nwn #1 [#2] #3
1018 {
1019 \color_set:nnn {#1}{#2}{#3}
1020 }
1021
1022 \cs_generate_variant:Nn \__hyp_color_set:nn {ne}
1023 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1024 {
1025 \hook_gput_code:nnn
1026 {pdfannot/link/#2/begin}
1027 {hyp/color}
1028 {
1029 \bool_if:cT { l_hyp_annot_color#1_bool }
1030 {
1031 \group_begin:
1032 \color_select:n { hyp/color/#1}
1033 }
1034 }
1035 \hook_gput_code:nnn
1036 {pdfannot/link/#2/end}
1037 {hyp/color}
1038 {
1039 \bool_if:cT { l_hyp_annot_color#1_bool }
1040 {
1041 \group_end:
1042 }
1043 }
1044 }
1045 \keys_define:nn { hyp }
1046 {
1047 ,colorlinks .choice:
1048 ,colorlinks / true .meta:n =
1049 {
1050 ,pdfborder={0~0~0}
1051 ,pdfborderstyle=
1052 ,colorurl =#1
1053 ,colorlink =#1
1054 ,colorrun =#1
1055 ,colormenu =#1
1056 ,colorfile =#1
1057 }
1058 ,colorlinks / false .meta:n =
1059 {
1060 ,colorurl =#1
1061 ,colorlink =#1
1062 ,colorrun =#1
1063 ,colormenu =#1
1064 ,colorfile =#1
1065 }
1066 ,colorlinks .default:n = {true}
1067 }
1068 \seq_map_inline:Nn \c__hyp_annot_types_seq
1069 {
1070 \keys_define:nn { hyp }
1071 {
1072 ,color#1 .bool_set:c = { l_hyp_annot_color#1_bool }
1073 ,#1color .code:n = { \__hyp_color_set:ne {hyp/color/#1}{##1} }
1074 }
1075 }
1076
1077 \keys_define:nn { hyp }
1078 {
1079 ,allcolors .meta:n =
1080 {
1081 ,urlcolor=#1
1082 ,linkcolor=#1
1083 ,runcolor=#1
1084 ,filecolor=#1
1085 ,menucolor=#1
1086 }
1087 ,allcolors .value_required:n = true
1088 }
1089 \keys_define:nn { hyp }
1090 {
1091 ,bordercolormodel .choices:nn =
1092 {rgb,cmyk}
1093 { \str_gset:Nn \g__hyp_bordercolormodel_str {space-sep-#1}}
1094 ,bordercolormodel .initial:n ={rgb}
1095 }
1096 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1097 {
1098 \keys_define:nn { hyp }
1099 {
1100 #1bordercolor .code:n =
1101 {
1102 \tl_if_empty:nTF { ##1 }
1103 {
1104 \pdfannot_dict_remove:nn
1105 {link/#2}
1106 { C }
1107 }
1108 {
1109 \__hyp_color_set:ne {hyp/color/#1border}{##1}
1110 \color_export:nVN
1111 {hyp/color/#1border}
1112 \g__hyp_bordercolormodel_str
1113 \l__hyp_tmpa_tl
1114 \pdfannot_dict_put:nne
1115 {link/#2}
1116 { C }
1117 { [\l__hyp_tmpa_tl] }
1118 }
1119 }
1120 }
1121 }
1122
1123 \keys_define:nn { hyp }
1124 {
1125 ,allbordercolors .meta:n =
1126 {
1127 ,linkbordercolor=#1
1128 ,urlbordercolor =#1
1129 ,filebordercolor=#1
1130 ,menubordercolor=#1
1131 ,runbordercolor =#1
1132 }
1133 ,allbordercolors .value_required:n = true
1134 }
1135
1136 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1137 {
1138 \keys_define:nn { hyp }
1139 {
1140 #1border .code:n =
1141 {
1142 \tl_if_empty:nTF { ##1 }
1143 {
1144 \pdfannot_dict_remove:nn
1145 {link/#2}
1146 { Border }
1147 }
1148 {
1149 \pdfannot_dict_put:nnn
1150 {link/#2}
1151 { Border }
1152 { [##1] }
1153 }
1154 }
1155 }
1156 }
1157 \keys_define:nn { hyp }
1158 {
1159 ,pdfborder .code:n =
1160 {
1161 \tl_if_empty:nTF { #1 }
1162 {
1163 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1164 {
1165 \pdfannot_dict_remove:nn
1166 {link/##2}
1167 { Border }
1168 }
1169 }
1170 {
1171 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1172 {
1173 \pdfannot_dict_put:nnn
1174 {link/##2}
1175 { Border }
1176 { [#1] }
1177 }
1178 }
1179 }
1180 ,pdfborder .initial:n = {0~0~1},
1181 }
1182 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1183 {
1184 \keys_define:nn { hyp }
1185 {
1186 #1borderstyle .code:n =
1187 {
1188 \tl_if_empty:nTF { ##1 }
1189 {
1190 \pdfannot_dict_remove:nn
1191 {link/#2}
1192 { BS }
1193 }
1194 {
1195 \pdfannot_dict_put:nnn
1196 {link/#2}
1197 { BS }
1198 { <<##1>> }
1199 }
1200 }
1201 }
1202 }
1203 \keys_define:nn { hyp }
1204 {
1205 ,pdfborderstyle .code:n =
1206 {
1207 \tl_if_empty:nTF { #1 }
1208 {
1209 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1210 {
1211 \pdfannot_dict_remove:nn
1212 {link/##2}
1213 { BS }
1214 }
1215 }
1216 {
1217 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1218 {
1219 \pdfannot_dict_put:nnn
1220 {link/##2}
1221 { BS }
1222 { <<#1>> }
1223 }
1224 }
1225 }
1226 ,pdfborderstyle .initial:n = {},
1227 }
1228 \cs_new_protected:Npn \__hyp_ocg_init:
1229 {
1230 \pdf_object_new:n { __hyp/OCG/View }
1231 \pdf_object_new:n { __hyp/OCG/Print }
1232 \pdf_object_new:n { __hyp/OCG/config }
1233 \pdf_object_new:n { __hyp/OCG/refarray }
1234 \pdf_object_write:nne { __hyp/OCG/refarray } { array }
1235 {
1236 \pdf_object_ref:n { __hyp/OCG/View }
1237 \c_space_tl
1238 \pdf_object_ref:n { __hyp/OCG/Print }
1239 }
1240 \pdf_object_write:nnn { __hyp/OCG/View } { dict }
1241 {
1242 /Type/OCG
1243 /Name(View)
1244 /Usage
1245 <<
1246 /Print <</PrintState/OFF>>~
1247 /View <</ViewState/ON >>~
1248 >>
1249 }
1250 \pdf_object_write:nnn { __hyp/OCG/Print } { dict }
1251 {
1252 /Type/OCG
1253 /Name(Print)
1254 /Usage
1255 <<
1256 /Print <</PrintState/ON>>~
1257 /View <</ViewState/OFF>>~
1258 >>
1259 }
1260 \pdfmanagement_add:nne { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {__hyp/OCG/View} }
1261 \pdfmanagement_add:nne { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {__hyp/OCG/Print} }
1262 \pdf_object_write:nne { __hyp/OCG/config } { dict }
1263 {
1264 /OFF[\pdf_object_ref:n { __hyp/OCG/Print }]
1265 /AS[
1266 <<
1267 /Event/View
1268 /OCGs\c_space_tl \pdf_object_ref:n { __hyp/OCG/refarray }
1269 /Category[/View]
1270 >>
1271 <<
1272 /Event/Print
1273 /OCGs\c_space_tl \pdf_object_ref:n { __hyp/OCG/refarray }
1274 /Category[/Print]
1275 >>
1276 <<
1277 /Event/Export
1278 /OCGs\c_space_tl \pdf_object_ref:n { __hyp/OCG/refarray }
1279 /Category[/Print]
1280 >>
1281 ]
1282 }
1283 \pdfmanagement_add:nne { Catalog / OCProperties }{ D }{ \pdf_object_ref:n { __hyp/OCG/config} }
1284 \cs_gset:Npn \__hyp_ocg_init: {}
1285 }
1286 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1287 {
1288 \hook_gput_code:nnn
1289 {pdfannot/link/#2/begin}
1290 {hyp/ocg}
1291 {
1292 \bool_if:cT { l_hyp_annot_ocgcolor#1_bool }
1293 {
1294 \__hyp_ocg_init:
1295 \group_begin:
1296 \hbox_set:Nw \l__hyp_tmpa_box
1297 }
1298 }
1299 \hook_gput_code:nnn
1300 {pdfannot/link/#2/end}
1301 {hyp/ocg}
1302 {
1303 \bool_if:cT { l_hyp_annot_ocgcolor#1_bool }
1304 {
1305 \hbox_set_end:
1306 \mbox
1307 {
1308 \pdf_bdcobject:nn {OC}{__hyp/OCG/Print}
1309 \hbox_overlap_right:n { \box_use:N \l__hyp_tmpa_box }
1310 \pdf_emc:
1311 \pdf_bdcobject:nn {OC}{__hyp/OCG/View}
1312 \group_begin:
1313 \color_select:n { hyp/color/#1 }
1314 \box_use_drop:N \l__hyp_tmpa_box
1315 \group_end:
1316 \pdf_emc:
1317 }
1318 \group_end:
1319 }
1320 }
1321 }
1322 \bool_lazy_or:nnTF
1323 { \pdf_version_compare_p:Nn > {1.4} }
1324 { \str_if_eq_p:ee{\pdf_version_major:}{-1} }
1325 {
1326 \keys_define:nn { hyp }
1327 {
1328 ,_ocgcolorlinks .meta:n =
1329 {
1330 ocgcolorlink=#1,
1331 ocgcolorurl=#1,
1332 ocgcolorfile=#1,
1333 ocgcolorrun=#1,
1334 ocgcolormenu=#1
1335 }
1336 ,_ocgcolorlinks .default:n = true
1337 }
1338 }
1339 {
1340 \keys_define:nn { hyp }
1341 {
1342 ,_ocgcolorlinks .code:n =
1343 {
1344 \msg_warning:nnee
1345 { hyp }
1346 { ignore-deprecated-or-unknown-option-in-pdf-version }
1347 { ocgcolorlinks } { \pdf_version_major:.\pdf_version_minor: }
1348 }
1349 }
1350 }
1351
1352 \keys_define:nn { hyp }
1353 {
1354 ,ocgcolorlinks .choice:
1355 ,ocgcolorlinks / true .meta:n =
1356 {
1357 pdfborder ={0~0~0},
1358 pdfborderstyle ={},
1359 colorlinks = false,
1360 _ocgcolorlinks = true
1361 }
1362 ,ocgcolorlinks / false .meta:n =
1363 {
1364 _ocgcolorlinks = false
1365 }
1366 ,ocgcolorlinks .default:n = {true}
1367 }
1368
1369 \seq_map_inline:Nn \c__hyp_annot_types_seq
1370 {
1371 \bool_lazy_or:nnTF
1372 { \pdf_version_compare_p:Nn > {1.4} }
1373 { \str_if_eq_p:ee{\pdf_version_major:}{-1} }
1374 {
1375 \keys_define:nn { hyp }
1376 {
1377 ,ocgcolor#1 .bool_set:c = { l_hyp_annot_ocgcolor#1_bool }
1378 }
1379 }
1380 {
1381 \keys_define:nn { hyp }
1382 {
1383 ,ocgcolor#1 .code:n=
1384 {
1385 \msg_warning:nnee
1386 { hyp }
1387 { ignore-deprecated-or-unknown-option-in-pdf-version }
1388 { ocgcolor#1 }
1389 { \pdf_version_major:.\pdf_version_minor: }
1390 }
1391 }
1392 }
1393 }
1394 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1395 {
1396 \keys_define:nn { hyp }
1397 {
1398 ,#1highlight .choices:nn =
1399 { /I, /N, /O, /P}
1400 {
1401 \pdfannot_dict_put:nnn
1402 {link/#2}
1403 { H }
1404 { ##1 }
1405
1406 }
1407 ,#1highlight / .code:n =
1408 {
1409 \pdfannot_dict_remove:nn
1410 {link/#2}
1411 { H }
1412
1413 }
1414 ,#1highlight / unknown .code:n =
1415 {
1416 \msg_warning:nneee { hyp } { unknown-choice+empty }
1417 { #1highlight }
1418 { /I~(inverse), /N~(no effect), /O~(outline), /P~(inset) }
1419 { \exp_not:n {##1} }
1420 }
1421 }
1422 }
1423
1424 \keys_define:nn { hyp }
1425 {
1426 ,pdfhighlight .choices:nn =
1427 { /I, /N, /O, /P}
1428 {
1429 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1430 {
1431 \pdfannot_dict_put:nnn
1432 {link/####2}
1433 { H }
1434 { #1 }
1435 }
1436 }
1437 ,pdfhighlight / .code:n =
1438 {
1439 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1440 {
1441 \pdfannot_dict_remove:nn
1442 {link/##2}
1443 { H }
1444 }
1445 }
1446 ,pdfhighlight .initial:n = {/I},
1447 ,pdfhighlight / unknown .code:n =
1448 {
1449 \msg_warning:nneee { hyp } { unknown-choice+empty }
1450 { pdfhighlight }
1451 { /I~(inverse), /N~(no effect), /O~(outline), /P~(inset) }
1452 { \exp_not:n {#1} }
1453 }
1454 }
1455 \keys_define:nn { hyp }
1456 {
1457 hidelinks .meta:n =
1458 {
1459 ,colorlinks = false
1460 ,ocgcolorlinks = false
1461 ,pdfborder = { 0~0~0 }
1462 ,pdfborderstyle=
1463 }
1464 }
1465
1466 \seq_map_inline:Nn \c__hyp_annot_types_seq
1467 {
1468 \keys_define:nn { hyp }
1469 {
1470 hide#1 .meta:n =
1471 {
1472 ,color#1 = false
1473 ,ocgcolor#1 = false
1474 ,#1border = { 0~0~0 }
1475 ,#1borderstyle =
1476 }
1477 }
1478 }
1479 \keys_define:nn { hyp }
1480 {
1481 colorscheme .code:n =
1482 {
1483 \prop_map_inline:cn { c__hyp_colorscheme_#1_prop }
1484 {
1485 \keys_set:nn { hyp }
1486 {
1487 ##1 = ##2
1488 }
1489 }
1490 }
1491 }
1492 \keys_set:nn { hyp } {colorscheme=phelype}
1493 \keys_define:nn { hyp }
1494 {
1495 ,unicode .code:n = {}
1496 ,pdfencoding .code:n = {}
1497 ,pdfversion .code:n =
1498 {
1499 \msg_warning:nn { hyp }{ pdfversion-disabled }
1500 }
1501 }
1502 \keys_define:nn { hyp }
1503 {
1504 ,verbose .legacy_if_set:n = {Hy@verbose}
1505 ,debug .legacy_if_set:n = {Hy@verbose}
1506 }
1507 \keys_define:nn { hyp }
1508 {
1509 ,draft .code:n =
1510 {
1511 \Hy@drafttrue
1512 \PassOptionsToPackage{draft}{bookmark}
1513 }
1514 ,final .code:n =
1515 {
1516 \Hy@finaltrue
1517 \PassOptionsToPackage{final}{bookmark}
1518 }
1519 }
1520 \keys_define:nn { hyp }
1521 {
1522 ,extension .tl_set:N = \XR@ext
1523 ,extension .initial:n= pdf
1524 ,hypertexnames .legacy_if_set:n = {Hy@hypertexnames}
1525 ,linkfileprefix .tl_set:N = \Hy@linkfileprefix
1526 ,localanchorname .legacy_if_set:n = {Hy@localanchorname}
1527 ,naturalnames .legacy_if_set:n = {Hy@naturalnames}
1528 ,pageanchor .legacy_if_set:n = {Hy@pageanchor}
1529 ,plainpages .legacy_if_set:n = {Hy@plainpages}
1530 }
1531
1532 \keys_define:nn { hyp }
1533 {
1534 ,linktoc .choices:nn = { none, section, all, page }
1535 {
1536 \cs_set_eq:Nc \Hy@linktoc { Hy@linktoc@#1 }
1537 }
1538 ,linktoc / unknown .code:n =
1539 {
1540 \msg_warning:nneee { hyp } { unknown-choice }
1541 { linktoc }
1542 { none, section, all, page }
1543 { \exp_not:n {#1} }
1544 }
1545 ,linktocpage .choice:
1546 ,linktocpage / true .meta:n = {linktoc=page}
1547 ,linktocpage / false .meta:n = {linktoc=section}
1548 ,linktocpage .default:n = true
1549 }
1550
1551 \prop_map_inline:Nn \c__hyp_map_hyp_annot_prop
1552 {
1553 \keys_define:nn { hyp }
1554 {
1555 ,#1 .bool_set:c = {l__hyp_annot_#2_bool}
1556 }
1557 }
1558 \keys_define:nn { hyp }
1559 {
1560 ,baseurl .code:n =
1561 {
1562 \__hyp_text_pdfstring:noN { #1 } {\l__hyp_text_enc_uri_print_tl} \l__hyp_tmpa_tl
1563 \tl_if_empty:NTF \l__hyp_tmpa_tl
1564 {
1565 \pdfmanagement_remove:nn {Catalog} { URI }
1566 }
1567 {
1568 \pdfmanagement_add:nne {Catalog} { URI }{ <</Base \l__hyp_tmpa_tl>> }
1569 }
1570 \__hyp_store_metadata:nn {baseurl}{#1}
1571 }
1572 ,bookmarks .choice:
1573 ,bookmarks / false .code:n = {\Hy@bookmarksfalse}
1574 ,bookmarks / true .code:n = {\Hy@bookmarkstrue}
1575 ,bookmarks .default:n = {true}
1576 ,bookmarksnumbered .code:n = {\bookmarksetup{numbered=#1}}
1577 ,bookmarksnumbered .default:n = true
1578 ,bookmarksopen .code:n = {\bookmarksetup{open=#1}}
1579 ,bookmarksopen .default:n = true
1580 ,bookmarksdepth .code:n = {\bookmarksetup{depth=#1}}
1581 ,bookmarksopenlevel .code:n = {\bookmarksetup{openlevel=#1}}
1582 ,bookmarkstype .tl_set:N = \Hy@bookmarkstype
1583 ,pdfcenterwindow .choice:
1584 ,pdfcenterwindow / false .code:n =
1585 {
1586 \pdfmanagement_remove:nn {Catalog / ViewerPreferences }{ CenterWindow }
1587 }
1588 ,pdfcenterwindow / true .code:n =
1589 {
1590 \pdfmanagement_add:nnn {Catalog / ViewerPreferences } { CenterWindow }{ true }
1591 }
1592 ,pdfcenterwindow / .code:n =
1593 {
1594 \pdfmanagement_remove:nn {Catalog / ViewerPreferences }{ CenterWindow }
1595 }
1596 ,pdfcenterwindow / unknown .code:n =
1597 {
1598 \msg_warning:nnee { hyp } { no-bool }
1599 { pdfcenterwindow }
1600 { \exp_not:n {#1} }
1601 }
1602 ,pdfcenterwindow .default:n = true
1603 ,pdfdirection .choice:
1604 ,pdfdirection / L2R .code:n =
1605 {
1606 \pdfmanagement_add:nnn {Catalog / ViewerPreferences } { Direction }{ /L2R }
1607 }
1608 ,pdfdirection / R2L .code:n =
1609 {
1610 \pdfmanagement_add:nnn {Catalog / ViewerPreferences } { Direction }{ /R2L }
1611 }
1612 ,pdfdirection / .code:n =
1613 {
1614 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { Direction }
1615 }
1616 ,pdfdirection / unknown .code:n =
1617 {
1618 \msg_warning:nneee { hyp } { unknown-choice+empty }
1619 { pdfdirection }
1620 { L2R , R2L }
1621 { \exp_not:n {#1} }
1622 }
1623 ,pdfdisplaydoctitle .choice:
1624 ,pdfdisplaydoctitle / false .code:n =
1625 {
1626 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { DisplayDocTitle }
1627 }
1628 ,pdfdisplaydoctitle / true .code:n =
1629 {
1630 \pdfmanagement_add:nnn {Catalog / ViewerPreferences } { DisplayDocTitle } { true }
1631 }
1632 ,pdfdisplaydoctitle .default:n = true
1633 ,pdfduplex .choices:nn =
1634 {Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge}
1635 {
1636 \pdf_version_compare:NnTF > {1.6}
1637 {
1638 \pdfmanagement_add:nnn {Catalog / ViewerPreferences }
1639 { Duplex } { /#1 }
1640 }
1641 {
1642 \msg_warning:nnee
1643 {hyp}
1644 {ignore-deprecated-or-unknown-option-in-pdf-version}
1645 {pdfduplex}
1646 {\pdf_version:}
1647 }
1648 }%
1649 ,pdfduplex / .code:n =
1650 {
1651 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { Duplex }
1652 }
1653 ,pdfduplex / unknown .code:n =
1654 {
1655 \msg_warning:nneee { hyp } { unknown-choice+empty }
1656 { pdfduplex }
1657 { Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge }
1658 { \exp_not:n {#1} }
1659 }
1660 ,pdffitwindow .choice:
1661 ,pdffitwindow / false .code:n =
1662 {
1663 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { FitWindow }
1664 }
1665 ,pdffitwindow / true .code:n =
1666 {
1667 \pdfmanagement_add:nnn {Catalog / ViewerPreferences } { FitWindow } { true }
1668 }
1669 ,pdffitwindow / .code:n =
1670 {
1671 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { FitWindow }
1672 }
1673 ,pdffitwindow .default:n = true
1674 ,pdffitwindow / unknown .code:n =
1675 {
1676 \msg_warning:nnee { hyp } { no-bool }
1677 { pdffitwindow }
1678 { \exp_not:n {#1} }
1679 }
1680 ,pdflinkmargin .code:n = { \pdfannot_link_margin:n { #1 } }
1681 ,pdflinkmargin .initial:n = {1pt}
1682 ,pdfmenubar .choice:
1683 ,pdfmenubar / true .code:n =
1684 {
1685 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideMenubar }
1686 }
1687 ,pdfmenubar / false .code:n =
1688 {
1689 \pdfmanagement_add:nn {Catalog / ViewerPreferences }
1690 { HideMenubar } { true }
1691 }
1692 ,pdfmenubar / .code:n =
1693 {
1694 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideMenubar }
1695 }
1696 ,pdfmenubar .default:n = true
1697 ,pdfmenubar / unknown .code:n =
1698 {
1699 \msg_warning:nnee { hyp } { no-bool }
1700 { pdfmenubar }
1701 { \exp_not:n {#1} }
1702 }
1703 ,pdfnewwindow .choice:
1704 ,pdfnewwindow / true .code:n =
1705 {
1706 \pdfdict_put:nnn {l_hyp/annot/A/GoToR}{/NewWindow}{true}
1707 \pdfdict_put:nnn {l_hyp/annot/A/Launch}{/NewWindow}{true}
1708 }
1709 ,pdfnewwindow / false .code:n =
1710 {
1711 \pdfdict_put:nnn {l_hyp/annot/A/GoToR}{/NewWindow}{false}
1712 \pdfdict_put:nnn {l_hyp/annot/A/Launch}{/NewWindow}{false}
1713 }
1714 ,pdfnewwindow / .code:n =
1715 {
1716 \pdfdict_remove:nn {l_hyp/annot/A/GoToR}{/NewWindow}
1717 \pdfdict_remove:nn {l_hyp/annot/A/Launch}{/NewWindow}
1718 }
1719 ,pdfnonfullscreenpagemode .choices:nn =
1720 { UseNone, UseOutlines, UseThumbs, FullScreen, UseOC } %pdf 1.5
1721 {
1722 \pdfmanagement_add:nne {Catalog / ViewerPreferences }
1723 { NonFullScreenPageMode} {/#1}
1724 }
1725 ,pdfnonfullscreenpagemode / UseAttachments .code:n =
1726 {
1727 \pdf_version_compare:NnTF < {1.6}
1728 {
1729 %message
1730 }
1731 {
1732 \pdfmanagement_add:nne {Catalog / ViewerPreferences }
1733 {NonFullScreenPageMode}{/UseAttachments}
1734 }
1735 }
1736 ,pdfnonfullscreenpagemode / .code:n =
1737 {
1738 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { NonFullScreenPageMode }
1739 }
1740 ,pdfnonfullscreenpagemode / unknown .code:n =
1741 {
1742 \msg_warning:nneee { hyp } { unknown-choice+empty }
1743 { pdfnonfullscreenpagemode }
1744 { UseNone, UseOutlines, UseThumbs, FullScreen, UseOC, UseAttachments (PDF 1.6) }
1745 { \exp_not:n {#1} }
1746 }
1747 ,pdfnumcopies .code:n =
1748 {
1749 \pdf_version_compare:NnTF > {1.6}
1750 {
1751 \tl_if_empty:nTF {#1}
1752 {
1753 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { NumCopies }
1754 }
1755 {
1756 \pdfmanagement_add:nne {Catalog / ViewerPreferences }
1757 {NumCopies}{#1}
1758 }
1759 }
1760 {
1761 \msg_warning:nnee
1762 {hyp}
1763 {ignore-deprecated-or-unknown-option-in-pdf-version}
1764 {pdfnumcopies}
1765 {\pdf_version:}
1766 }
1767 }
1768 ,pdfpagelayout .choices:nn =
1769 { SinglePage, OneColumn, TwoColumnLeft, TwoColumnRight, TwoPageLeft, TwoPageRight}
1770 { \pdfmanagement_add:nne {Catalog} { PageLayout }{ /#1 } }
1771 ,pdfpagelayout / .code:n =
1772 { \pdfmanagement_remove:nn {Catalog} { PageLayout } }
1773 ,pdfpagelayout / unknown .code:n =
1774 {
1775 \msg_warning:nneee { hyp } { unknown-choice+empty }
1776 { pdfpagelayout }
1777 { SinglePage, OneColumn, TwoColumnLeft, TwoColumnRight, TwoPageLeft, TwoPageRight }
1778 { \exp_not:n {#1} }
1779 }
1780 ,pdfpagemode .choices:nn =
1781 { UseNone, UseOutlines, UseThumbs, FullScreen, UseOC } %pdf 1.5
1782 { \pdfmanagement_add:nne {Catalog} { PageMode }{ /#1 } }
1783 ,pdfpagemode / UseAttachments .code:n =
1784 {
1785 \pdf_version_compare:NnTF > {1.5}
1786 {
1787 \pdfmanagement_add:nne {Catalog} { PageMode }{ /UseAttachments }
1788 }
1789 {
1790 \msg_warning:nnee
1791 {hyp}
1792 {ignore-deprecated-or-unknown-value-in-pdf-version}
1793 {UseAttachments}
1794 {\pdf_version:}
1795 }
1796 }
1797 ,pdfpagemode .initial:n = { UseOutlines } %for now ...
1798 ,pdfpagemode / unknown .code:n =
1799 {
1800 \msg_warning:nneee { hyp } { unknown-choice+empty }
1801 { pdfpagemode }
1802 { UseNone, UseOutlines, UseThumbs, FullScreen, UseOC, UseAttachments (PDF 1.6) }
1803 { \exp_not:n {#1} }
1804 }
1805 ,pdfpagescrop .code:n =
1806 {
1807 \tl_if_empty:nTF {#1} %or blank?
1808 {
1809 \pdfmanagement_remove:nn {Pages} { CropBox }
1810 }
1811 {
1812 \pdfmanagement_add:nne {Pages} { CropBox } { [#1] }
1813 }
1814 }
1815 ,pdfpicktraybypdfsize .choice:
1816 ,pdfpicktraybypdfsize / true .code:n =
1817 {
1818 \pdf_version_compare:NnTF > {1.6}
1819 {
1820 \pdfmanagement_add:nnn {Catalog / ViewerPreferences }
1821 { PickTrayByPDFSize } { true }
1822 }
1823 {
1824 \msg_warning:nnee
1825 {hyp}
1826 {ignore-deprecated-or-unknown-option-in-pdf-version}
1827 {pdfpicktraybypdfsize}
1828 {\pdf_version:}
1829 }
1830 }
1831 ,pdfpicktraybypdfsize / false .code:n =
1832 {
1833 \pdf_version_compare:NnTF > {1.6}
1834 {
1835 \pdfmanagement_add:nnn {Catalog / ViewerPreferences }
1836 { PickTrayByPDFSize } { false }
1837 }
1838 {
1839 \msg_warning:nnee
1840 {hyp}
1841 {ignore-deprecated-or-unknown-option-in-pdf-version}
1842 {pdfpicktraybypdfsize}
1843 {\pdf_version:}
1844 }
1845 }
1846 ,pdfpicktraybypdfsize / .code:n =
1847 {
1848 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { PickTrayByPDFSize }
1849 }
1850 ,pdfpicktraybypdfsize / unknown .code:n =
1851 {
1852 \msg_warning:nnee { hyp } { no-bool }
1853 { picktraybypdfsize }
1854 { \exp_not:n {#1} }
1855 }
1856 ,pdfprintarea .choices:nn =
1857 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
1858 {
1859 \pdf_version_compare:NnTF < {2.0}
1860 {
1861 \pdfmanagement_add:nne {Catalog / ViewerPreferences }
1862 { PrintArea } { /#1 }
1863 }
1864 {
1865 \msg_warning:nnee
1866 {hyp}
1867 {ignore-deprecated-or-unknown-option-in-pdf-version}
1868 {pdfprintarea}
1869 {\pdf_version:}
1870 }
1871 }%
1872 ,pdfprintarea / .code:n =
1873 { \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { PrintArea } }
1874 ,pdfprintarea / unknown .code:n =
1875 {
1876 \msg_warning:nneee { hyp } { unknown-choice+empty }
1877 { pdfprintarea }
1878 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
1879 { \exp_not:n {#1} }
1880 }
1881 ,pdfprintclip .choices:nn =
1882 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
1883 {
1884 \pdf_version_compare:NnTF < {2.0}
1885 {
1886 \pdfmanagement_add:nne {Catalog / ViewerPreferences }
1887 { PrintClip } { /#1 }
1888 }
1889 {
1890 \msg_warning:nnee
1891 {hyp}
1892 {ignore-deprecated-or-unknown-option-in-pdf-version}
1893 {pdfprintclip}
1894 {\pdf_version:}
1895 }
1896 }%
1897 ,pdfprintclip / .code:n =
1898 {
1899 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { PrintClip }
1900 }
1901 ,pdfprintclip / unknown .code:n =
1902 {
1903 \msg_warning:nneee
1904 { hyp }
1905 { unknown-choice+empty }
1906 { pdfprintclip }
1907 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
1908 { \exp_not:n {#1} }
1909 }
1910 ,pdfprintpagerange .code:n =
1911 {
1912 \pdf_version_compare:NnTF > {1.6}
1913 {
1914 \tl_if_empty:nTF { #1}
1915 {
1916 \pdfmanagement_remove:nn {Catalog / ViewerPreferences }
1917 { PrintPageRange }
1918 }
1919 {
1920 \pdfmanagement_add:nne {Catalog / ViewerPreferences }
1921 {PrintPageRange}{[#1]}
1922 }
1923 }
1924 {
1925 \msg_warning:nnee
1926 {hyp}
1927 {ignore-deprecated-or-unknown-option-in-pdf-version}
1928 {pdfprintpagerange}
1929 {\pdf_version:}
1930 }
1931 }
1932 ,pdfprintscaling .choices:nn =
1933 { None, AppDefault }
1934 {
1935 \pdf_version_compare:NnTF > {1.5}
1936 {
1937 \pdfmanagement_add:nne {Catalog / ViewerPreferences }
1938 { PrintScaling } { /#1 }
1939 }
1940 {
1941 \msg_warning:nnee
1942 {hyp}
1943 {ignore-deprecated-or-unknown-option-in-pdf-version}
1944 {pdfprintscaling}
1945 {\pdf_version:}
1946 }
1947 }%
1948 ,pdfprintscaling / .code:n =
1949 {
1950 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } {PrintScaling }
1951 }
1952 ,pdfprintscaling / unknown .code:n =
1953 {
1954 \msg_warning:nneee { hyp } { unknown-choice+empty }
1955 { pdfprintarea }
1956 { None, AppDefault }
1957 { \exp_not:n {#1} }
1958 }
1959 ,pdfremotestartview .code:n =
1960 {
1961 \tl_set:Ne \l__hyp_tmpa_tl {#1~null~null~null~}
1962 \exp_args:NNV
1963 \regex_extract_once:NnNTF \c__hyp_dest_startview_regex \l__hyp_tmpa_tl \l__hyp_tmpa_seq
1964 {
1965 \tl_set:Ne \l__hyp_dest_pdfremotestartview_tl {\seq_item:Nn \l__hyp_tmpa_seq {1}}
1966 }
1967 {
1968 \msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfremotestartview}
1969 \tl_set:Nn \l__hyp_dest_pdfremotestartview_tl {Fit}
1970 }
1971 }
1972 ,pdfremotestartview .initial:n = {Fit}
1973 % pdfstartpage is special as it shares code with pdfstartview
1974 ,pdfstartpage .code:n =
1975 {
1976 \tl_gset:Ne \g__hyp_dest_pdfstartpage_tl { #1 }
1977 \bool_if:nTF
1978 { \tl_if_empty_p:N \g__hyp_dest_pdfstartpage_tl || \tl_if_empty_p:N \g__hyp_dest_pdfstartview_tl }
1979 {
1980 \pdfmanagement_remove:nn {Catalog} { OpenAction }
1981 }
1982 {
1983 \pdfmanagement_add:nne {Catalog} { OpenAction }
1984 {
1985 [\pdf_pageobject_ref:n {\g__hyp_dest_pdfstartpage_tl}~/\g__hyp_dest_pdfstartview_tl]
1986 }
1987 }
1988 }
1989 ,pdfstartpage .initial:n =1
1990 ,pdfstartview .code:n =
1991 {
1992 \tl_set:Ne \l__hyp_tmpa_tl {#1~null~null~null~}
1993 \exp_args:NNV
1994 \regex_extract_once:NnNTF \c__hyp_dest_startview_regex \l__hyp_tmpa_tl \l__hyp_tmpa_seq
1995 {
1996 \tl_gset:Ne \g__hyp_dest_pdfstartview_tl {\seq_item:Nn \l__hyp_tmpa_seq {1}}
1997 }
1998 {
1999 \msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfstartview}
2000 \tl_gset:Nn \g__hyp_dest_pdfstartview_tl {Fit}
2001 }
2002 \bool_if:nTF
2003 { \tl_if_empty_p:N \g__hyp_dest_pdfstartpage_tl || \tl_if_empty_p:N \g__hyp_dest_pdfstartview_tl }
2004 {
2005 \pdfmanagement_remove:nn {Catalog} { OpenAction }
2006 }
2007 {
2008 \pdfmanagement_add:nne {Catalog} { OpenAction }
2009 {
2010 [\pdf_pageobject_ref:n {\g__hyp_dest_pdfstartpage_tl}~/\g__hyp_dest_pdfstartview_tl]
2011 }
2012 }
2013 }
2014 ,pdfstartview .initial:n = Fit
2015 ,pdftoolbar .choice:
2016 ,pdftoolbar / true .code:n =
2017 {
2018 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideToolbar }
2019 }
2020 ,pdftoolbar / false .code:n =
2021 {
2022 \pdfmanagement_add:nnn {Catalog / ViewerPreferences }
2023 { HideToolbar } { true }
2024 }
2025 ,pdftoolbar / true .code:n =
2026 {
2027 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideToolbar }
2028 }
2029 ,pdftoolbar .default:n = true
2030 ,pdftoolbar / unknown .code:n =
2031 {
2032 \msg_warning:nnee { hyp } { no-bool }
2033 { pdftoolbar }
2034 { \exp_not:n {#1} }
2035 }
2036 % pdfview see below.
2037 ,pdfviewarea .choices:nn =
2038 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
2039 {
2040 \pdf_version_compare:NnTF < {2.0}
2041 {
2042 \pdfmanagement_add:nnn {Catalog / ViewerPreferences }
2043 { ViewArea } { /#1 }
2044 }
2045 {
2046 \msg_warning:nnee
2047 {hyp}
2048 {ignore-deprecated-or-unknown-option-in-pdf-version}
2049 {pdfviewarea}
2050 {\pdf_version:}
2051 }
2052 }%
2053 ,pdfviewarea / .code:n =
2054 {
2055 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { ViewArea }
2056 }
2057 ,pdfviewarea / unknown .code:n =
2058 {
2059 \msg_warning:nneee { hyp } { unknown-choice+empty }
2060 { pdfviewarea }
2061 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
2062 { \exp_not:n {#1} }
2063 }
2064 ,pdfviewclip .choices:nn =
2065 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
2066 {
2067 \pdf_version_compare:NnTF < {2.0}
2068 {
2069 \pdfmanagement_add:nnn {Catalog / ViewerPreferences }
2070 { ViewClip } { /#1 }
2071 }
2072 {
2073 \msg_warning:nnee
2074 {hyp}
2075 {ignore-deprecated-or-unknown-option-in-pdf-version}
2076 {pdfviewclip}
2077 {\pdf_version:}
2078 }
2079 }%
2080 ,pdfviewclip / .code:n =
2081 {
2082 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { ViewClip }
2083 }
2084 ,pdfviewclip / unknown .code:n =
2085 {
2086 \msg_warning:nneee { hyp } { unknown-choice+empty }
2087 { pdfviewclip }
2088 { MediaBox, CropBox, BleedBox, TrimBox, ArtBox }
2089 { \exp_not:n {#1} }
2090 }
2091 ,pdfwindowui .choice:
2092 ,pdfwindowui / true .code:n =
2093 {
2094 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } { HideWindowUI }
2095 }
2096 ,pdfwindowui / false .code:n =
2097 {
2098 \pdfmanagement_add:nnn {Catalog / ViewerPreferences }
2099 { HideWindowUI } { true }
2100 }
2101 ,pdfwindowui / .code:n =
2102 {
2103 \pdfmanagement_remove:nn {Catalog / ViewerPreferences } {HideWindowUI }
2104 }
2105 ,pdfwindowui / unknown .code:n =
2106 {
2107 \msg_warning:nnee { hyp } { no-bool }
2108 { pdfwindowui }
2109 { \exp_not:n {#1} }
2110 }
2111 ,pdfwindowui .default:n = true
2112 }
2113 \keys_define:nn { hyp }
2114 {
2115 ,pdfview .code:n =
2116 {
2117 \seq_set_split:Nnn \l__hyp_tmpa_seq {~}{#1}
2118 \str_case_e:nnF { \str_lowercase:f{ \seq_item:Nn \l__hyp_tmpa_seq {1} } }
2119 {
2120 { xyz }
2121 {
2122 \int_compare:nNnTF {\seq_count:N \l__hyp_tmpa_seq } > { 1 }
2123 {
2124 \seq_get_right:NN \l__hyp_tmpa_seq \l__hyp_tmpa_tl
2125 \tl_if_eq:NnTF \l__hyp_tmpa_tl {null}
2126 {
2127 \tl_set:Nn \l__hyp_dest_pdfview_tl {xyz}
2128 }
2129 {
2130 \tl_set:Ne \l__hyp_dest_pdfview_tl
2131 {
2132 \fp_eval:n { \l__hyp_tmpa_tl * 100 }
2133 }
2134 }
2135 }
2136 {
2137 \tl_set:Nn \l__hyp_dest_pdfview_tl {xyz}
2138 }
2139 }
2140 { fit } { \tl_set:Nn \l__hyp_dest_pdfview_tl {fit} }
2141 { fitb } { \tl_set:Nn \l__hyp_dest_pdfview_tl {fitb} }
2142 { fitbh } { \tl_set:Nn \l__hyp_dest_pdfview_tl {fitbh}}
2143 { fitbv } { \tl_set:Nn \l__hyp_dest_pdfview_tl {fitbv}}
2144 { fith } { \tl_set:Nn \l__hyp_dest_pdfview_tl {fith} }
2145 { fitv } { \tl_set:Nn \l__hyp_dest_pdfview_tl {fitv} }
2146 { fitr }
2147 {
2148 \int_compare:nNnTF {\seq_count:N \l__hyp_tmpa_seq } = {1}
2149 {
2150 \tl_set:Nn \l__hyp_dest_pdfview_tl {fitr}
2151 }
2152 {
2153 %ensure 4 values ...
2154 \tl_set:Nn \l__hyp_dest_pdfview_tl {fitrbox}
2155 \seq_put_right:Nn \l__hyp_tmpa_seq {0}
2156 \seq_put_right:Nn \l__hyp_tmpa_seq {0}
2157 \seq_put_right:Nn \l__hyp_tmpa_seq {0}
2158 \hbox_set_to_wd:Nnn \l__hyp_dest_box
2159 {
2160 \fp_eval:n
2161 {
2162 round
2163 (
2164 abs
2165 (
2166 \seq_item:Nn\l__hyp_tmpa_seq{4}
2167 -
2168 (\seq_item:Nn\l__hyp_tmpa_seq{2})
2169 ),
2170 3
2171 )
2172 }bp
2173 }{}
2174 \box_set_dp:Nn \l__hyp_dest_box
2175 {
2176 \fp_eval:n
2177 {
2178 round(0 - (\seq_item:Nn\l__hyp_tmpa_seq{3}),3)
2179 }bp
2180 }
2181 \box_set_ht:Nn \l__hyp_dest_box
2182 {
2183 \seq_item:Nn\l__hyp_tmpa_seq{5}bp
2184 }
2185 }
2186 }
2187 }
2188 {
2189 \msg_warning:nnnn {hyp}{invalid-destination-value}{#1}{pdfview}
2190 \tl_set:Nn \l__hyp_dest_pdfview_tl {fit}
2191 }
2192 }
2193 ,pdfview .initial:n = {xyz}
2194 }
2195 \keys_define:nn { hyp }
2196 {
2197 ,pdflang .code:n =
2198 {
2199 \tl_if_empty:nF { #1 }
2200 {
2201 \pdfmanagement_add:nne {Catalog} { Lang } { (#1) }
2202 \AddToDocumentProperties[document]{lang}{#1}
2203 }
2204 }
2205 }
2206 \regex_new:N\l__hyp_optlang_regex
2207 \regex_set:Nn\l__hyp_optlang_regex {\A\[([A-Za-z\-]+)\](.*)}
2208 \cs_generate_variant:Nn\clist_item:nn{on}
2209 \cs_new_protected:Npn \__hyp_setup_info_key:nn #1 #2
2210 {
2211 \keys_define:nn { hyp }
2212 {
2213 pdf#1 .code:n =
2214 {
2215 \tl_set:Ne\l__hyp_tmpa_tl {\text_expand:n{##1}}
2216 \__hyp_store_metadata:no {pdf#1}{\l__hyp_tmpa_tl}
2217 \tl_if_empty:NTF \l__hyp_tmpa_tl
2218 {
2219 \str_case:nnF { #1 }
2220 {
2221 {creator}
2222 {
2223 \msg_info:nnn { hyp }{ empty-info-value } { pdfcreator }
2224 \pdfmanagement_add:nne {Info}{Creator}{()}
2225 }
2226 {producer}
2227 {
2228 \msg_info:nnn { hyp }{ empty-info-value } { pdfproducer }
2229 \pdfmanagement_add:nne {Info}{Producer}{()}
2230 }
2231 }
2232 {
2233 \pdfmanagement_remove:nn {Info}{#2}
2234 }
2235 }
2236 {
2237 \tl_set:Ne\l__hyp_tmpb_tl {\clist_item:on{\l__hyp_tmpa_tl}{1}}
2238 \exp_args:NNV
2239 \regex_extract_once:NnN \l__hyp_optlang_regex \l__hyp_tmpb_tl\l__hyp_tmpa_seq
2240 \seq_if_empty:NTF\l__hyp_tmpa_seq
2241 {
2242 \__hyp_text_pdfstring_info:oN {\l__hyp_tmpa_tl}\l__hyp_tmpa_str
2243 }
2244 {
2245 \__hyp_text_pdfstring_info:eN {\seq_item:Nn \l__hyp_tmpa_seq{3}}\l__hyp_tmpa_str
2246 }
2247 \str_if_eq:VnF\l__hyp_tmpa_str{<FEFF>}
2248 {
2249 \pdfmanagement_add:nne {Info}{#2}{\l__hyp_tmpa_str}
2250 }
2251 }
2252 }
2253 }
2254 \keys_define:nn { hyp / info }
2255 {
2256 #2 .code:n =
2257 {
2258 \tl_set:Ne\l__hyp_tmpa_tl {\text_expand:n{##1}}
2259 \__hyp_store_metadata:eo {pdf\str_lowercase:n{#1}}{\l__hyp_tmpa_tl}
2260 \tl_if_blank:nTF {##1}
2261 {
2262 \pdfmanagement_remove:nn {Info}{#2}
2263 }
2264 {
2265 \__hyp_text_pdfstring_info:oN {\l__hyp_tmpa_tl}\l__hyp_tmpa_str
2266 \str_if_eq:VnF\l__hyp_tmpa_str{<FEFF>}
2267 {
2268 \pdfmanagement_add:nne {Info}{#2}{\l__hyp_tmpa_str}
2269 }
2270 }
2271 }
2272 ,unknown .code:n =
2273 {
2274 \__hyp_text_pdfstring_info:eN {##1}\l__hyp_tmpa_str
2275 \str_if_eq:VnF\l__hyp_tmpa_str{<FEFF>}
2276 {
2277 \exp_args:Nno
2278 \pdfmanagement_add:nne {Info}
2279 { \l_keys_key_str } {\l__hyp_tmpa_str}
2280 }
2281 }
2282 }
2283 }
2284 \__hyp_setup_info_key:nn {author} {Author}
2285 \__hyp_setup_info_key:nn {title} {Title}
2286 \__hyp_setup_info_key:nn {producer} {Producer}
2287 \__hyp_setup_info_key:nn {creator} {Creator}
2288 \__hyp_setup_info_key:nn {subject} {Subject}
2289 \__hyp_setup_info_key:nn {keywords} {Keywords}
2290 \cs_new_protected:Npn \__hyp_setup_info_date_key:nn #1 #2
2291 {
2292 \keys_define:nn { hyp }
2293 {
2294 pdf#1 .code:n =
2295 {
2296 \tl_if_blank:nTF {##1}
2297 {
2298 \pdfmanagement_remove:nn {Info}{#2}
2299 }
2300 {
2301 \pdfmanagement_add:nne {Info}{#2}{(##1)}
2302 }
2303 \__hyp_store_metadata:nn {pdf#1}{##1}
2304 \AddToDocumentProperties[document]{#1}{##1}
2305 }
2306 }
2307 \keys_define:nn { hyp / info }
2308 {
2309 #2 .code:n =
2310 {
2311 \tl_if_blank:nTF {##1}
2312 {
2313 \pdfmanagement_remove:nn {Info}{#2}
2314 }
2315 {
2316 \pdfmanagement_add:nne {Info}{#2}{(##1)}
2317 }
2318 \exp_args:Ne \__hyp_store_metadata:nn {pdf\str_lowercase:n{#1}}{##1}
2319 }
2320 }
2321 }
2322
2323 \__hyp_setup_info_date_key:nn {creationdate} {CreationDate}
2324 \__hyp_setup_info_date_key:nn {moddate} {ModDate}
2325 \keys_define:nn { hyp }
2326 {
2327 pdfmetadate .code:n = { \__hyp_store_metadata:nn {pdfmetadate}{#1} }
2328 }
2329 \keys_define:nn { hyp }
2330 {
2331 ,pdftrapped .code:n =
2332 {
2333 \exp_args:Nne
2334 \keys_set:nn { hyp } { _pdftrapped = \str_uppercase:n { #1 } }
2335 }
2336 ,_pdftrapped .choices:nn = {TRUE,FALSE,UNKNOWN}
2337 {
2338 \pdfmanagement_add:nne {Info}{Trapped}
2339 {/
2340 \str_uppercase:f { \str_head:n { #1 } }
2341 \str_lowercase:f { \str_tail:n { #1 } }
2342 }
2343 \__hyp_store_metadata:ne {pdftrapped}
2344 {
2345 \str_uppercase:f { \str_head:n { #1 } }
2346 \str_lowercase:f { \str_tail:n { #1 } }
2347 }
2348 }
2349 ,_pdftrapped / unknown .code:n =
2350 {
2351 \msg_warning:nneee { hyp } { unknown-choice }
2352 { pdftrapped }
2353 { true~(case~insensitive), false~(case~insensitive), unknown~(case~insensitive) }
2354 { \exp_not:n {#1} }
2355 }
2356 }
2357 \keys_define:nn { hyp }
2358 {
2359 pdfinfo .code:n =
2360 {
2361 \keys_set:nn { hyp / info } { #1 }
2362 }
2363 }
2364 \keys_set:nn { hyp} {pdfcreator = LaTeX~with~hyperref}
2365 \keys_set:nn { hyp} {pdfauthor = }
2366 \keys_set:nn { hyp} {pdftitle = }
2367 \keys_set:nn { hyp} {pdfsubject = }
2368 \clist_map_inline:nn
2369 {
2370 ,pdfcopyright
2371 ,pdftype
2372 ,pdflicenseurl
2373 ,pdfauthortitle
2374 ,pdfcaptionwriter
2375 ,pdfmetalang
2376 ,pdfsource
2377 ,pdfdocumentid
2378 ,pdfinstanceid
2379 ,pdfversionid
2380 ,pdfrendition
2381 ,pdfpublication
2382 ,pdfpubtype
2383 ,pdfbytes
2384 ,pdfnumpages
2385 ,pdfissn
2386 ,pdfeissn
2387 ,pdfisbn
2388 ,pdfbookedition
2389 ,pdfpublisher
2390 ,pdfvolumenum
2391 ,pdfissuenum
2392 ,pdfpagerange
2393 ,pdfdoi
2394 ,pdfurl
2395 ,pdfidentifier
2396 ,pdfsubtitle
2397 ,pdfpubstatus
2398 ,pdfcontactaddress
2399 ,pdfcontactcity
2400 ,pdfcontactregion
2401 ,pdfcontactpostcode
2402 ,pdfcontactcountry
2403 ,pdfcontactphone
2404 ,pdfcontactemail
2405 ,pdfcontacturl
2406 ,pdfdate
2407 ,pdftdmreservation
2408 ,pdftdmpolicy
2409 }
2410 {
2411 \keys_define:nn { hyp }
2412 {
2413 #1 .code:n= { \__hyp_store_metadata:nn {#1}{##1}}
2414 }
2415 }
2416
2417 \keys_define:nn { hyp }
2418 {
2419 pdfpageduration .code:n =
2420 {
2421 \tl_if_blank:nTF { #1 }
2422 {
2423 \pdfmanagement_remove:nn {Page}{Dur}
2424 }
2425 {
2426 \pdfmanagement_add:nnn {Page}{Dur}{#1}
2427 }
2428 }
2429 }
2430 \keys_define:nn { hyp }
2431 {
2432 pdfpagetransition .code:n =
2433 {
2434 \tl_if_blank:nTF {#1}
2435 {
2436 \pdfmanagement_remove:nn {Page}{Trans}
2437 }
2438 {
2439 \group_begin:
2440 \keys_set:nn { hyp / trans }{style=R,#1}
2441 \pdf_object_unnamed_write:ne { dict }
2442 {
2443 \pdfdict_use:n {l__hyp_page/Trans}
2444 }
2445 \pdfmanagement_add:nne {Page}{Trans}{\pdf_object_ref_last:}
2446 \group_end:
2447 }
2448 }
2449 }
2450 \keys_define:nn { hyp / trans }
2451 {
2452 ,style .choices:nn =
2453 {Split,Blinds,Box,Wipe,Dissolve,Glitter,R,Fly,Push,Cover,Uncover,Fade}
2454 { \pdfdict_put:nnn {l__hyp_page/Trans}{ S }{/#1} }
2455 ,style / unknown .code:n =
2456 {
2457 \msg_warning:nneee { hyp } { unknown-choice }
2458 { trans / style }
2459 { Split,Blinds,Box,Wipe,Dissolve,Glitter,R,Fly,Push,Cover,Uncover,Fade }
2460 { \exp_not:n {#1} }
2461 }
2462 ,duration .code:n =
2463 {
2464 \pdfdict_put:nnn {l__hyp_page/Trans}{ D }{#1}
2465 }
2466 ,direction .choices:nn =
2467 {H,V}
2468 { \pdfdict_put:nnn {l__hyp_page/Trans}{ Dm }{/#1} }
2469 ,direction .choices:nn =
2470 {0,90,180,270,315}
2471 { \pdfdict_put:nnn {l__hyp_page/Trans}{ Di }{ #1 } }
2472 ,direction / None .code:n =
2473 { \pdfdict_put:nnn {l__hyp_page/Trans}{ Di }{ /None } }
2474 ,direction / unknown .code:n =
2475 {
2476 \msg_warning:nneee { hyp } { unknown-choice }
2477 { trans / direction }
2478 {
2479 H~(horizontal,~only~Split,~Blinds),
2480 V~(vertical,~only~Split,~Blinds),
2481 0~(left~to~right,~only~Wipe,~Glitter,~Fly,~Cover,~Uncover,~Push),
2482 90~(bottom~to~top,~only~Wipe),
2483 180~(right~to~left,~only~Wipe),
2484 270~(top~to~bottom,~only~Wipe,~Glitter,~Fly,~Cover,~Uncover,~Push),
2485 315~(top~left~to~bottom,~only~Glitter),
2486 None~(only~Fly)
2487 }
2488 { \exp_not:n {#1} }
2489 }
2490 ,motion .choices:nn =
2491 {I,O}
2492 { \pdfdict_put:nnn {l__hyp_page/Trans}{ M }{/#1} }
2493 ,motion / unknown .code:n =
2494 {
2495 \msg_warning:nneee { hyp } { unknown-choice }
2496 { trans / motion }
2497 { I~(inwards) , O~(outwards) }
2498 { \exp_not:n {#1} }
2499 }
2500 ,scale .code:n =
2501 { \pdfdict_put:nnn { l__hyp_page/Trans }{ SS }{ #1 } }
2502 ,opaque .choices:nn = {true,false}
2503 { \pdfdict_put:nnn { l__hyp_page/Trans }{ B } { #1} }
2504 ,opaque / unknown .code:n =
2505 {
2506 \msg_warning:nneee { hyp } { unknown-choice }
2507 { trans / B }
2508 { true~(opaque~back,~only~Fly), false~(opaque~back,~only~Fly) }
2509 { \exp_not:n {#1} }
2510 }
2511 % try to set unknown keys as style
2512 ,unknown .code:n =
2513 {
2514 % warning ...
2515 \exp_args:Nne\keys_set:nn {hyp/trans}{ style=\l_keys_key_str }
2516 }
2517 }
2518 \keys_set_known:nv{ hyp }{[email protected]}
2519 %% Form field code
2520 \NewDocumentCommand \MakeFieldObject { m m }
2521 {
2522 \pdfxform_new:nnn { #2 }{} { #1 }
2523 }
2524
2525 \prop_new:N \g__hyp_AcroForm_CoFields_prop
2526 \prop_new:N \g__hyp_AcroForm_Fields_prop
2527
2528 \let\HyField@afields\@empty
2529 \let\HyField@cofields\@empty
2530 \def\HyField@AfterAuxOpen{\Hy@AtBeginDocument}%
2531
2532 \def\HyField@AuxAddToFields#1
2533 {
2534 \prop_gput:Nnn \g__hyp_AcroForm_Fields_prop {#1}{F}
2535 }%
2536
2537 \def\HyField@AuxAddToCoFields #1 #2
2538 {
2539 \prop_gput:Nnn \g__hyp_AcroForm_CoFields_prop {a#1}{#2}
2540 }
2541
2542 \Hy@AtBeginDocument
2543 {
2544 \if@filesw
2545 \immediate\write\@mainaux{%
2546 \string\providecommand\string\HyField@AuxAddToFields[1]{}%
2547 }%
2548 \immediate\write\@mainaux{%
2549 \string\providecommand\string\HyField@AuxAddToCoFields[2]{}%
2550 }%
2551 \fi
2552 \let\HyField@AfterAuxOpen\@firstofone
2553 }%
2554
2555 \def\HyField@AddToFields
2556 {
2557 \exp_args:Ne\HyField@@AddToFields
2558 {
2559 \pdfannot_box_ref_last:
2560 }
2561 \ifx\Fld@calculate@code\@empty
2562 \else
2563 \begingroup
2564 \Hy@safe@activestrue
2565 \edef\Hy@temp{%
2566 \endgroup
2567 \if@filesw
2568 \write\@mainaux
2569 {
2570 \string\HyField@AuxAddToCoFields
2571 {
2572 \Fld@calculate@sortkey
2573 }
2574 {
2575 \pdfannot_box_ref_last:
2576 }
2577 }
2578 \fi
2579 }%
2580 \Hy@temp
2581 \fi
2582 }%
2583
2584 \def\HyField@@AddToFields#1{
2585 \HyField@AfterAuxOpen{%
2586 \if@filesw
2587 \write\@mainaux{%
2588 \string\HyField@AuxAddToFields{#1}%
2589 }%
2590 \fi
2591 }%
2592 }%
2593
2594 \ExplSyntaxOff
2595 \ExplSyntaxOn
2596
2597 \def\@Form[#1]
2598 {
2599 \kvsetkeys{Form}{#1}
2600 \pdf@ifdraftmode{}
2601 {
2602 \Hy@FormObjects
2603 \prop_map_inline:Nn \g__hyp_AcroForm_Fields_prop
2604 {
2605 \pdfmanagement_add:nne { Catalog / AcroForm } { Fields }{##1}
2606 %\pdfmanagement_show:n { Catalog / AcroForm }
2607 }
2608 \prop_if_empty:NF \g__hyp_AcroForm_CoFields_prop
2609 {
2610 \prop_map_inline:Nn \g__hyp_AcroForm_CoFields_prop
2611 {
2612 \seq_put_right:Nn \l__hyp_tmpa_seq {##1}
2613 }
2614 \seq_sort:Nn \l__hyp_tmpa_seq
2615 {
2616 \str_compare:nNnTF {##1} > {##2}
2617 { \sort_return_swapped: }
2618 { \sort_return_same: }
2619 }
2620 \seq_map_inline:Nn \l__hyp_tmpa_seq
2621 {
2622 \pdfmanagement_add:nne { Catalog / AcroForm }
2623 { CO }
2624 {
2625 \prop_item:Nn \g__hyp_AcroForm_CoFields_prop {##1}
2626 }
2627 }
2628 }
2629 \pdfmanagement_add:nne {Catalog / AcroForm/DR/Font }
2630 {ZaDb} {\pdf_object_ref:n {__hyp/Font/ZaDb} }
2631 \pdfmanagement_add:nne {Catalog / AcroForm/DR/Font }
2632 {Helv} {\pdf_object_ref:n {__hyp/Font/Helv} }
2633 \pdfmanagement_add:nne {Catalog /AcroForm}
2634 {DA}{(/Helv~10~Tf~0~g)}
2635 \pdfmeta_standard_verify:nTF {form_no_NeedAppearance}
2636 {
2637 \legacy_if:nT { HyField@NeedAppearances }
2638 {
2639 \pdfmanagement_add:nnn {Catalog / AcroForm }{NeedAppearances}{true}
2640 }
2641 }
2642 {
2643 \pdfmanagement_remove:nn {Catalog / AcroForm }{NeedAppearances}
2644 }
2645 }
2646 }
2647 \ExplSyntaxOff
2648 \let\@endForm\@empty
2649 \let\HyAnn@AbsPageLabel\@empty
2650 \let\Fld@pageobjref\@empty
2651
2652 \ExplSyntaxOn
2653 \newcount\HyAnn@Count
2654 \HyAnn@Count=\z@
2655 \def\HyAnn@AbsPageLabel
2656 {
2657 \global\advance\HyAnn@Count by\@ne
2658 \__hyp_property_record:ee {HyAnn@\the\HyAnn@Count}{abspage}
2659 \property_ref_undefined_warn:ee {HyAnn@\the\HyAnn@Count}{abspage}
2660 }%
2661 \prg_generate_conditional_variant:Nnn \property_if_recorded:nn {ee} {T}
2662 \def\Fld@pageobjref
2663 {
2664 \property_if_recorded:eeT {HyAnn@\the\HyAnn@Count}{abspage}
2665 {
2666 /P~\pdf_pageobject_ref:e
2667 {
2668 \property_ref:ee{HyAnn@\the\HyAnn@Count}{abspage}
2669 }
2670 }
2671 }
2672 %% check if the attr should be set through
2673 %% hooks.
2674 %% check if options are missing.
2675 \def\@TextField[#1]#2{% parameters, label
2676 \def\Fld@name{#2}%
2677 \let\Fld@default\@empty
2678 \let\Fld@value\@empty
2679 \def\Fld@width{\DefaultWidthofText}%
2680 \def\Fld@height{%
2681 \ifFld@multiline
2682 \DefaultHeightofTextMultiline
2683 \else
2684 \DefaultHeightofText
2685 \fi
2686 }%
2687 \begingroup
2688 \expandafter\HyField@SetKeys\expandafter{%
2689 \DefaultOptionsofText,#1%
2690 }%
2691 \PDFForm@Name
2692 \HyField@FlagsText
2693 \ifFld@hidden\def\Fld@width{1sp}\fi
2694 \ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi
2695 \LayoutTextField{#2}{%
2696 \leavevmode
2697 \HyAnn@AbsPageLabel
2698 \Hy@escapeform\PDFForm@Text
2699 \pdfannot_box:nnnn
2700 {\Fld@width}
2701 {\Fld@height}
2702 {0pt} %is this correct?
2703 {\PDFForm@Text}
2704 \MakeTextField{\Fld@width}{\Fld@height}
2705 \HyField@AddToFields
2706 }%
2707 \endgroup
2708 }
2709 \providecommand\@curropt{}
2710 \def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
2711 \def\Fld@name{#2}
2712 \let\Fld@default\relax
2713 \let\Fld@value\relax
2714 \def\Fld@width{\DefaultWidthofChoiceMenu}
2715 \def\Fld@height{\DefaultHeightofChoiceMenu}
2716 \begingroup
2717 \Fld@menulength=0 %
2718 \@tempdima\z@
2719 \clist_map_variable:nNn { #3 } \@curropt
2720 %\@for\@curropt:=#3\do
2721 {%
2722 \expandafter\Fld@checkequals\@curropt==\\%
2723 \Hy@StepCount\Fld@menulength
2724 \settowidth{\@tempdimb}{\@currDisplay}%
2725 \ifdim\@tempdimb>\@tempdima\@tempdima\@tempdimb\fi
2726 }%
2727 \advance\@tempdima by~15\p@
2728 \begingroup
2729 \HyField@SetKeys{#1}
2730 \edef\x{\endgroup
2731 \noexpand\expandafter
2732 \noexpand\HyField@SetKeys
2733 \noexpand\expandafter{%
2734 \expandafter\noexpand\csname DefaultOptionsof%
2735 \ifFld@radio
2736 Radio%
2737 \else
2738 \ifFld@combo
2739 \ifFld@popdown
2740 PopdownBox%
2741 \else
2742 ComboBox%
2743 \fi
2744 \else
2745 ListBox%
2746 \fi
2747 \fi
2748 \endcsname
2749 }%
2750 }\x
2751 \HyField@SetKeys{#1}%
2752 \PDFForm@Name
2753 \ifFld@hidden\def\Fld@width{1sp}\fi
2754 \ifx\Fld@value\relax
2755 \let\Fld@value\Fld@default
2756 \fi
2757 \LayoutChoiceField{#2}{%
2758 \ifFld@radio
2759 \HyField@FlagsRadioButton
2760 \@@Radio{#3}%
2761 \else
2762 \begingroup
2763 \HyField@FlagsChoice
2764 \ifdim\Fld@width<\@tempdima
2765 \ifdim\@tempdima<1cm\@tempdima1cm\fi
2766 \edef\Fld@width{\the\@tempdima}%
2767 \fi
2768 \ifFld@combo
2769 \else
2770 \@tempdima=\the\Fld@menulength\Fld@charsize
2771 \advance\@tempdima by~\Fld@borderwidth bp %
2772 \advance\@tempdima by~\Fld@borderwidth bp %
2773 \edef\Fld@height{\the\@tempdima}%
2774 \fi
2775 \@@Listbox{#3}%
2776 \endgroup
2777 \fi
2778 }%
2779 \endgroup
2780 }
2781
2782 \def\@@Radio#1{%
2783 \Fld@listcount=0~%
2784 \EdefEscapeName\Fld@default{\Fld@default}%
2785 \clist_map_variable:nNn { #1 } \@curropt
2786 {%
2787 \expandafter\Fld@checkequals\@curropt==\\%
2788 \EdefEscapeName\@currValue{\@currValue}%
2789 \Hy@StepCount\Fld@listcount
2790 \@currDisplay\space
2791 \leavevmode
2792 \HyAnn@AbsPageLabel
2793 \Hy@escapeform\PDFForm@Radio
2794 \pdfxform_if_exist:nF { __hyp_xform_Ding }
2795 {
2796 \pdfxform_new:nnn { __hyp_xform_Ding } {}
2797 {
2798 \group_begin:
2799 \fontfamily{pzd}
2800 \fontencoding{U}
2801 \fontseries{m}
2802 \fontshape{n}
2803 \selectfont
2804 \char123
2805 \group_end:
2806 }
2807 }
2808 \pdfannot_box:nnne
2809 {\Fld@width}
2810 {\Fld@height}
2811 {0pt} %is this correct?
2812 {
2813 \PDFForm@Radio
2814 /AP
2815 <<
2816 /N
2817 <<
2818 /\@currValue\c_space_tl \pdfxform_ref:n {__hyp_xform_Ding}
2819 %/Off \c_space_tl \pdfxform_ref:n {__hyp_xform_DingOff} %hm
2820 >>
2821 >>
2822 }
2823 {\fbox{ \MakeRadioField{\Fld@width}{\Fld@height}} }
2824 \int_compare:nNnT { \Fld@listcount} = { 1 }
2825 { \HyField@AddToFields }
2826 \c_space_tl % deliberate space between radio buttons
2827 % to do: --> should be configurable
2828 }%
2829 }
2830
2831 \newcount\Fld@listcount
2832 \def\@@Listbox#1
2833 {
2834 \HyField@PDFChoices{#1}
2835 \mode_leave_vertical:
2836 \HyAnn@AbsPageLabel
2837 \Hy@escapeform\PDFForm@List
2838 \pdfannot_box:nnnn
2839 {\Fld@width}{\Fld@height}{0pt}
2840 {\PDFForm@List}
2841 \MakeChoiceField{\Fld@width}{\Fld@height}
2842 \HyField@AddToFields
2843 }
2844
2845 \def\@PushButton[#1]#2{% parameters, label
2846 \def\Fld@name{#2}%
2847 \group_begin:
2848 \exp_args:No\HyField@SetKeys
2849 {
2850 \DefaultOptionsofPushButton,#1
2851 }
2852 \PDFForm@Name
2853 \pdfmeta_standard_verify:nnTF {annot_action_A}{JavaScript}
2854 {
2855 \HyField@FlagsPushButton
2856 \legacy_if:nT {Fld@hidden}
2857 {
2858 \def\Fld@width{1sp}
2859 }
2860 \LayoutPushButtonField
2861 {
2862 \mode_leave_vertical:
2863 \HyAnn@AbsPageLabel
2864 \Hy@escapeform\PDFForm@Push
2865 \hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}}
2866 \pdfannot_box:nnnn
2867 {\box_wd:N\l_tmpa_box}
2868 {\box_ht:N\l_tmpa_box}
2869 {\box_dp:N\l_tmpa_box} %is this correct?
2870 {\PDFForm@Push}
2871 {\box_use:N\l_tmpa_box}
2872 \HyField@AddToFields
2873 }
2874 }
2875 {
2876 \msg_error:nn { hyp }{ pdfa-no-push-button }
2877 \LayoutPushButtonField
2878 {
2879 \mode_leave_vertical:
2880 \MakeButtonField{#2}
2881 }
2882 }
2883 \group_end:
2884 }
2885
2886 \def\@Submit[#1]#2
2887 {
2888 \def\Fld@width {\DefaultWidthofSubmit}
2889 \def\Fld@height{\DefaultHeightofSubmit}
2890 \group_begin:
2891 \exp_args:No\HyField@SetKeys
2892 {
2893 \DefaultOptionsofSubmit,#1
2894 }
2895 \HyField@FlagsPushButton
2896 \HyField@FlagsSubmit
2897 \legacy_if:nT { Fld@hidden }
2898 {
2899 \def\Fld@width{1sp}
2900 }
2901 \mode_leave_vertical:
2902 \HyAnn@AbsPageLabel
2903 \Hy@escapeform\PDFForm@Submit
2904 \hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}}
2905 \pdfxform_if_exist:nF
2906 { __hyp_xform_Submit }
2907 {
2908 \pdfxform_new:nnn { __hyp_xform_Submit }{}
2909 {
2910 \fbox{\color_select:n{yellow}\textsf{Submit}}
2911 }
2912 \pdfxform_new:nnn { __hyp_xform_SubmitP }{}
2913 {
2914 \fbox{\color_select:n{yellow}\textsf{SubmitP}}
2915 }
2916 }
2917 \pdfannot_box:nnnn
2918 {\box_wd:N\l_tmpa_box}
2919 {\box_ht:N\l_tmpa_box}
2920 {\box_dp:N\l_tmpa_box} %is this correct?
2921 {
2922 \PDFForm@Submit
2923 /AP<<
2924 /N~\pdfxform_ref:n {__hyp_xform_Submit}~
2925 /D~\pdfxform_ref:n {__hyp_xform_SubmitP}
2926 >>
2927 }
2928 \HyField@AddToFields
2929 \box_use:N\l_tmpa_box
2930
2931 \group_end:
2932 }
2933
2934 \def\@Reset[#1]#2
2935 {
2936 \def\Fld@width {\DefaultWidthofReset}
2937 \def\Fld@height{\DefaultHeightofReset}
2938 \group_begin:
2939 \exp_args:No\HyField@SetKeys
2940 {
2941 \DefaultOptionsofReset,#1
2942 }
2943 \mode_leave_vertical:
2944 \pdfmeta_standard_verify:nnTF {annot_action_A}{ResetForm}
2945 {
2946 \HyField@FlagsPushButton
2947 \legacy_if:nT { Fld@hidden }
2948 { \def\Fld@width{1sp} }
2949 \HyAnn@AbsPageLabel
2950 \Hy@escapeform\PDFForm@Reset
2951 \hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}}
2952 \pdfannot_box:nnnn
2953 {\box_wd:N\l_tmpa_box}
2954 {\box_ht:N\l_tmpa_box}
2955 {\box_dp:N\l_tmpa_box} %is this correct?
2956 { \PDFForm@Reset }
2957 \HyField@AddToFields
2958 \box_use:N \l_tmpa_box
2959 }
2960 {
2961 \msg_error:nn { hyp }{ pdfa-no-reset-button }
2962 \MakeButtonField{#2}
2963 }
2964 \group_end:
2965 }
2966
2967 \def\@CheckBox[#1]#2
2968 {% parameters, label
2969 \def\Fld@name{#2}
2970 \def\Fld@default{0}
2971 \group_begin:
2972 \def\Fld@width {\DefaultWidthofCheckBox}
2973 \def\Fld@height{\DefaultHeightofCheckBox}
2974 \exp_args:No\HyField@SetKeys
2975 {
2976 \DefaultOptionsofCheckBox,#1
2977 }
2978 \PDFForm@Name
2979 \HyField@FlagsCheckBox
2980 \legacy_if:nT { Fld@hidden }
2981 {
2982 \def\Fld@width{1sp}
2983 }
2984 \LayoutCheckField{#2}
2985 {
2986 \mode_leave_vertical:
2987 \HyAnn@AbsPageLabel
2988 \Hy@escapeform\PDFForm@Check
2989 \pdfxform_if_exist:nF { __hyp_xform_CheckMarkYes }
2990 {
2991 \pdfxform_new:nnn
2992 {__hyp_xform_CheckMarkYes}{}
2993 {
2994 \group_begin:
2995 \fontfamily{pzd}
2996 \fontencoding{U}
2997 \fontseries{m}
2998 \fontshape{n}
2999 \selectfont
3000 \char51
3001 \group_end:
3002 }
3003 \pdfxform_new:nnn
3004 {__hyp_xform_CheckMarkOff}{}
3005 {
3006 \group_begin:
3007 \fontfamily{pzd}
3008 \fontencoding{U}
3009 \fontseries{m}
3010 \fontshape{n}
3011 \selectfont
3012 \phantom{\char51} %perhaps xetex needs some small glyph ..
3013 \group_end:
3014 }
3015 }
3016 \pdfannot_box:nnnn
3017 {\Fld@width}
3018 {\Fld@height}
3019 {0pt} %is this correct?
3020 {\PDFForm@Check}
3021 \HyField@AddToFields %check if this works with xelatex ...
3022 }
3023 \group_end:
3024 }
3025 \def\Hy@FormObjects
3026 {
3027 \pdf_object_new:n {__hyp/Encoding/pdfdoc }
3028 \pdf_object_new:n {__hyp/Font/ZaDb }
3029 \pdf_object_new:n {__hyp/Font/Helv }
3030 \pdf_object_write:nne {__hyp/Encoding/pdfdoc } { dict }
3031 {
3032 /Type/Encoding
3033 /Differences[
3034 24/breve/caron/circumflex/dotaccent/hungarumlaut/ogonek
3035 /ring/tilde
3036 \c_space_tl
3037 39/quotesingle
3038 \c_space_tl
3039 96/grave %
3040 \iow_newline:
3041 128/bullet/dagger/daggerdbl/ellipsis/emdash/endash/florin
3042 /fraction/guilsinglleft/guilsinglright/minus/perthousand
3043 /quotedblbase/quotedblleft/quotedblright/quoteleft
3044 /quoteright/quotesinglbase/trademark/fi/fl/Lslash/OE
3045 /Scaron/Ydieresis/Zcaron/dotlessi/lslash/oe/scaron/zcaron
3046 \iow_newline:
3047 164/currency
3048 \c_space_tl
3049 166/brokenbar
3050 \c_space_tl
3051 168/dieresis/copyright/ordfeminine
3052 \c_space_tl
3053 172/logicalnot/.notdef/registered/macron/degree/plusminus
3054 /twosuperior/threesuperior/acute/mu
3055 \c_space_tl
3056 183/periodcentered/cedilla/onesuperior/ordmasculine
3057 \c_space_tl
3058 188/onequarter/onehalf/threequarters
3059 \iow_newline:
3060 192/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
3061 /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave
3062 /Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute
3063 /Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave
3064 /Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
3065 /agrave/aacute/acircumflex/atilde/adieresis/aring/ae
3066 /ccedilla/egrave/eacute/ecircumflex/edieresis/igrave
3067 /iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute
3068 /ocircumflex/otilde/odieresis/divide/oslash/ugrave
3069 /uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
3070 ]
3071 }
3072 \pdf_object_write:nnn {__hyp/Font/ZaDb } { dict }
3073 {
3074 /Type/Font
3075 /Subtype/Type1
3076 /Name/ZaDb
3077 /BaseFont/ZapfDingbats
3078 }
3079 \pdf_object_write:nne {__hyp/Font/Helv } { dict }
3080 {
3081 /Type/Font
3082 /Subtype/Type1
3083 /Name/Helv
3084 /BaseFont/Helvetica
3085 /Encoding~\pdf_object_ref:n { __hyp/Encoding/pdfdoc }
3086 }
3087 \global\let\Hy@FormObjects\relax
3088 }
3089 \ExplSyntaxOff
3090 \providecommand*{\Fld@pageobjref}{}
3091 \ifcsname pdf@escapestring\endcsname
3092 \def\Hy@escapeform#1{%
3093 \ifHy@pdfescapeform
3094 \let\Hy@escapestring\pdfescapestring
3095 \else
3096 \let\Hy@escapestring\@firstofone
3097 \fi
3098 }%
3099 \Hy@escapeform{}%
3100 \else
3101 \let\Hy@escapestring\@firstofone
3102 \def\Hy@escapeform#1{%
3103 \ifHy@pdfescapeform
3104 \def\Hy@escapestring##1{%
3105 \noexpand\Hy@escapestring{\noexpand##1}%
3106 }%
3107 \edef\Hy@temp{#1}%
3108 \expandafter\Hy@@escapeform\Hy@temp\Hy@escapestring{}\@nil
3109 \def\Hy@escapestring##1{%
3110 \@ifundefined{Hy@esc@\string##1}{%
3111 ##1%
3112 \ThisShouldNotHappen
3113 }{%
3114 \csname Hy@esc@\string##1\endcsname
3115 }%
3116 }%
3117 \else
3118 \let\Hy@escapestring\@firstofone
3119 \fi
3120 }%
3121 \def\Hy@@escapeform#1\Hy@escapestring#2#3\@nil{%
3122 \ifx\\#3\\%
3123 \else
3124 \expandafter
3125 \Hy@pstringdef\csname Hy@esc@\string#2\endcsname{#2}% probably string-hex
3126 \Hy@ReturnAfterFi{%
3127 \Hy@@escapeform#3\@nil
3128 }%
3129 \fi
3130 }%
3131 \fi
3132 \def\PDFForm@Name{%
3133 \PDFForm@@Name\Fld@name
3134 \ifx\Fld@altname\relax
3135 \else
3136 \PDFForm@@Name\Fld@altname
3137 \fi
3138 \ifx\Fld@mappingname\relax
3139 \else
3140 \PDFForm@@Name\Fld@mappingname
3141 \fi
3142 }
3143 \def\PDFForm@@Name#1{%
3144 \begingroup
3145 \ifnum\Hy@pdfversion<5 % implementation note 117, PDF spec 1.7
3146 \ifHy@unicode
3147 \Hy@unicodefalse
3148 \fi
3149 \fi
3150 \pdfstringdef\Hy@gtemp#1%
3151 \endgroup
3152 \let#1\Hy@gtemp
3153 }
3154 \def\Fld@X@additionalactions{%
3155 \ifx\Fld@keystroke@code\@empty
3156 \else
3157 /K<</S/JavaScript/JS(\Hy@escapestring{\Fld@keystroke@code})>>%
3158 \fi
3159 \ifx\Fld@format@code\@empty
3160 \else
3161 /F<</S/JavaScript/JS(\Hy@escapestring{\Fld@format@code})>>%
3162 \fi
3163 \ifx\Fld@validate@code\@empty
3164 \else
3165 /V<</S/JavaScript/JS(\Hy@escapestring{\Fld@validate@code})>>%
3166 \fi
3167 \ifx\Fld@calculate@code\@empty
3168 \else
3169 /C<</S/JavaScript/JS(\Hy@escapestring{\Fld@calculate@code})>>%
3170 \fi
3171 \ifx\Fld@onfocus@code\@empty
3172 \else
3173 /Fo<</S/JavaScript/JS(\Hy@escapestring{\Fld@onfocus@code})>>%
3174 \fi
3175 \ifx\Fld@onblur@code\@empty
3176 \else
3177 /Bl<</S/JavaScript/JS(\Hy@escapestring{\Fld@onblur@code})>>%
3178 \fi
3179 \ifx\Fld@onmousedown@code\@empty
3180 \else
3181 /D<</S/JavaScript/JS(\Hy@escapestring{\Fld@onmousedown@code})>>%
3182 \fi
3183 \ifx\Fld@onmouseup@code\@empty
3184 \else
3185 /U<</S/JavaScript/JS(\Hy@escapestring{\Fld@onmouseup@code})>>%
3186 \fi
3187 \ifx\Fld@onenter@code\@empty
3188 \else
3189 /E<</S/JavaScript/JS(\Hy@escapestring{\Fld@onenter@code})>>%
3190 \fi
3191 \ifx\Fld@onexit@code\@empty
3192 \else
3193 /X<</S/JavaScript/JS(\Hy@escapestring{\Fld@onexit@code})>>%
3194 \fi
3195 }
3196 \ExplSyntaxOn
3197 \def\Fld@additionalactions
3198 {%
3199 \exp_args:Ne\str_if_eq:nnF {\Fld@X@additionalactions}{}
3200 {
3201 \pdfmeta_standard_verify:nT {annot_widget_no_AA}
3202 {/AA<<\Fld@X@additionalactions>>}
3203 }
3204 }
3205 \def\Fld@annotnames{%
3206 /T(\Fld@name)%
3207 \ifx\Fld@altname\relax
3208 \else
3209 /TU(\Fld@altname)%
3210 \fi
3211 \ifx\Fld@mappingname\relax
3212 \else
3213 /TM(\Fld@mappingname)%
3214 \fi
3215 }
3216
3217 \def\PDFForm@Check
3218 {
3219 /Subtype/Widget
3220 ~\Fld@annotflags
3221 ~\Fld@pageobjref
3222 ~\Fld@annotnames
3223 /FT/Btn
3224 \Fld@flags
3225 /Q~\Fld@align
3226 /BS<</W~\Fld@borderwidth /S/\Fld@borderstyle>>
3227 /AP
3228 <<
3229 /N
3230 <<
3231 /Yes~\pdfxform_ref:n{__hyp_xform_CheckMarkYes}
3232 /Off~\pdfxform_ref:n{__hyp_xform_CheckMarkOff}
3233 >>
3234 >>
3235 /MK<<
3236 \int_compare:nNnF {\Fld@rotation}={0}
3237 {
3238 /R~\Fld@rotation
3239 }
3240 \tl_if_empty:NF\Fld@bordercolor
3241 {
3242 /BC[\Fld@bordercolor]
3243 }
3244 \tl_if_empty:NF\Fld@bcolor
3245 {
3246 /BG[\Fld@bcolor]
3247 }
3248 /CA(\Hy@escapestring{\Fld@cbsymbol})%
3249 >>
3250 /DA
3251 (
3252 /ZaDb~\strip@pt\Fld@charsize\c_space_tl Tf
3253 \tl_if_empty:NF \Fld@color
3254 {
3255 \c_space_tl \Fld@color
3256 }
3257 )
3258 /H/P
3259 \legacy_if:nTF {Fld@checked}
3260 {
3261 /V/Yes /AS/Yes
3262 }
3263 {
3264 /V/Off /AS/Off
3265 }
3266 \Fld@additionalactions
3267 }
3268
3269 \def\PDFForm@Push
3270 {
3271 /Subtype/Widget
3272 ~\Fld@annotflags
3273 ~\Fld@pageobjref
3274 ~\Fld@annotnames
3275 /FT/Btn
3276 ~\Fld@flags
3277 /H/P
3278 /BS<</W~\Fld@borderwidth/S/\Fld@borderstyle>>
3279 \bool_if:nT
3280 {
3281 !\int_compare_p:nNn {\Fld@rotation} = {0}
3282 ||
3283 \tl_if_exist_p:N \Fld@bordercolor
3284 }
3285 {
3286 /MK
3287 <<
3288 \int_compare:nNnF {\Fld@rotation} = {0}
3289 {
3290 /R~\Fld@rotation
3291 }
3292 \tl_if_exist:NT \Fld@bordercolor
3293 {
3294 /BC[\Fld@bordercolor]
3295 }
3296 >>
3297 }
3298 /A<</S/JavaScript/JS(\Hy@escapestring{\Fld@onclick@code})>>
3299 \Fld@additionalactions
3300 }
3301
3302 \ExplSyntaxOff
3303 \def\PDFForm@List{%
3304 /Subtype/Widget%
3305 \Fld@annotflags
3306 \Fld@pageobjref
3307 \Fld@annotnames
3308 /FT/Ch%
3309 \Fld@flags
3310 /Q \Fld@align
3311 /BS<</W \Fld@borderwidth/S/\Fld@borderstyle>>%
3312 \ifcase0\ifnum\Fld@rotation=\z@ \else 1\fi
3313 \ifx\Fld@bordercolor\relax\else 1\fi
3314 \ifx\fld@bcolor\relax \else 1\fi
3315 \space
3316 \else
3317 /MK<<%
3318 \ifnum\Fld@rotation=\z@
3319 \else
3320 /R \Fld@rotation
3321 \fi
3322 \ifx\Fld@bordercolor\relax
3323 \else
3324 /BC[\Fld@bordercolor]%
3325 \fi
3326 \ifx\Fld@bcolor\relax
3327 \else
3328 /BG[\Fld@bcolor]%
3329 \fi
3330 >>%
3331 \fi
3332 /DA(/Helv \strip@pt\Fld@charsize\space Tf%
3333 \ifx\Fld@color\@empty\else\space\Fld@color\fi)%
3334 \Fld@choices
3335 \Fld@additionalactions
3336 }
3337 \ExplSyntaxOn
3338 \def\PDFForm@Radio
3339 {
3340 /Subtype/Widget
3341 ~\Fld@annotflags
3342 ~\Fld@pageobjref
3343 ~\Fld@annotnames
3344 /FT/Btn
3345 \Fld@flags
3346 /H/P
3347 /BS<</W~\Fld@borderwidth/S/\Fld@borderstyle>>
3348 /MK<<
3349 \ifnum\Fld@rotation=\z@
3350 \else
3351 /R~\Fld@rotation
3352 \fi
3353 \ifx\Fld@bordercolor\relax
3354 \else
3355 /BC[\Fld@bordercolor]%
3356 \fi
3357 \ifx\Fld@bcolor\relax
3358 \else
3359 /BG[\Fld@bcolor]%
3360 \fi
3361 /CA(\Hy@escapestring{\Fld@radiosymbol})%
3362 >>
3363 /DA(/ZaDb~\strip@pt\Fld@charsize\space Tf%
3364 \ifx\Fld@color\@empty\else\space\Fld@color\fi)%
3365 \ifx\Fld@default\@empty
3366 /V/Off%
3367 /DV/Off%
3368 \else
3369 /V/\Fld@default
3370 /DV/\Fld@default
3371 \fi
3372 \Fld@additionalactions
3373 }
3374
3375 \def\PDFForm@Text
3376 {
3377 /Subtype/Widget
3378 ~\Fld@annotflags
3379 ~\Fld@pageobjref
3380 ~\Fld@annotnames
3381 /FT/Tx
3382 ~\Fld@flags
3383 /Q~\Fld@align
3384 /BS<</W~\Fld@borderwidth\c_space_tl /S /\Fld@borderstyle>>
3385 \bool_if:nT
3386 {
3387 !\int_compare_p:nNn {\Fld@rotation} = {0}
3388 ||
3389 \tl_if_exist_p:N \Fld@bordercolor
3390 ||
3391 \tl_if_exist_p:N \Fld@bcolor
3392 }
3393 {
3394 /MK
3395 <<
3396 \int_compare:nNnF {\Fld@rotation} = {0}
3397 {
3398 /R~\Fld@rotation
3399 }
3400 \tl_if_exist:NT \Fld@bordercolor
3401 {
3402 /BC[\Fld@bordercolor]
3403 }
3404 \tl_if_exist:NT \Fld@bcolor
3405 {
3406 /BG[\Fld@bcolor]
3407 }
3408 >>
3409 }
3410 /DA
3411 (
3412 /Helv~\strip@pt\Fld@charsize\c_space_tl Tf
3413 \tl_if_empty:NF {\c_space_tl\Fld@color}
3414 )
3415 /DV(\Hy@escapestring{\Fld@default})
3416 /V(\Hy@escapestring{\Fld@value})
3417 ~\Fld@additionalactions
3418 \int_compare:nNnT { \Fld@maxlen}>{0}
3419 {
3420 /MaxLen~\Fld@maxlen
3421 }
3422 }
3423 \ExplSyntaxOff
3424
3425 \def\PDFForm@Submit{%
3426 /Subtype/Widget%
3427 \Fld@annotflags
3428 \Fld@pageobjref
3429 \Fld@annotnames
3430 /FT/Btn%
3431 \Fld@flags
3432 /H/P%
3433 /BS<</W \Fld@borderwidth/S/\Fld@borderstyle>>%
3434 \ifcase0\ifnum\Fld@rotation=\z@ \else 1\fi
3435 \ifx\Fld@bordercolor\relax\else 1\fi
3436 \space
3437 \else
3438 /MK<<%
3439 \ifnum\Fld@rotation=\z@
3440 \else
3441 /R \Fld@rotation
3442 \fi
3443 \ifx\Fld@bordercolor\relax
3444 \else
3445 /BC[\Fld@bordercolor]%
3446 \fi
3447 >>%
3448 \fi
3449 /A<<%
3450 /S/SubmitForm%
3451 /F<<%
3452 /FS/URL%
3453 /F(\Hy@escapestring{\Form@action})%
3454 >>%
3455 \Fld@submitflags
3456 >>%
3457 \Fld@additionalactions
3458 }
3459 \ExplSyntaxOn
3460 \def\PDFForm@Reset{%
3461 /Subtype/Widget%
3462 \Fld@annotflags
3463 \Fld@pageobjref
3464 \Fld@annotnames
3465 /FT/Btn%
3466 \Fld@flags
3467 /H/P%
3468 /DA(/Helv~\strip@pt\Fld@charsize\space Tf~0~0~1~rg)%
3469 \ifcase0\ifnum\Fld@rotation=\z@ \else 1\fi
3470 \ifx\Fld@bordercolor\relax\else 1\fi
3471 \space
3472 \else
3473 /MK<<%
3474 \ifnum\Fld@rotation=\z@
3475 \else
3476 /R~\Fld@rotation
3477 \fi
3478 \ifx\Fld@bordercolor\relax
3479 \else
3480 /BC[\Fld@bordercolor]%
3481 \fi
3482 >>%
3483 \fi
3484 /BS<</W \Fld@borderwidth/S/\Fld@borderstyle>>%
3485 /A<</S/ResetForm>>%
3486 \Fld@additionalactions
3487 }%
3488
3489 %these patterns are used in hyperref checks.
3490 \str_case:VnF \c_sys_backend_str
3491 {
3492 { pdfmode }
3493 {
3494 \def\HyPat@ObjRef
3495 {
3496 [0-9]*[1-9][0-9]*~0~R
3497 }
3498 }
3499 { dvipdfmx }
3500 {
3501 \def\HyPat@ObjRef
3502 {
3503 @[^~]+
3504 }
3505 }
3506 { xdvipdfmx }
3507 {
3508 \def\HyPat@ObjRef
3509 {
3510 @[^~]+
3511 }
3512 }
3513 }
3514 { %also set in hyperref sty, so probably not needed.
3515 \def\HyPat@ObjRef/{.+}
3516 }
3517
3518 \ExplSyntaxOff
3519 %% \RequirePackage{rerunfilecheck}[2009/12/10]
3520 %% removed \Hy@OutlineRerunCheck, unneeded with bookmark
3521 %% removed \ReadBookmarks / unneeded with bookmark.
3522 %% removed \Hy@OutlineName
3523 %% removed \check@bm@number
3524 %% removed \calc@bm@number
3525
3526 \ifHy@implicit
3527 \else
3528 \expandafter\endinput
3529 \fi
3530 \newlength\Hy@SectionHShift
3531 \def\Hy@SectionAnchorHref#1{%
3532 \ifx\protect\@typeset@protect
3533 \Hy@@SectionAnchor{#1}%
3534 \fi
3535 }
3536 \DeclareRobustCommand*{\Hy@@SectionAnchor}[1]{%
3537 \leavevmode
3538 \hbox to 0pt{%
3539 \kern-\Hy@SectionHShift
3540 \Hy@raisedlink{%
3541 \hyper@anchorstart{#1}\hyper@anchorend
3542 }%
3543 \hss
3544 }%
3545 }
3546 \@ifundefined{hyper@nopatch@sectioning}
3547 {
3548 \let\H@old@ssect\@ssect
3549 \def\@ssect#1#2#3#4#5{%
3550 \Hy@MakeCurrentHrefAuto{section*}%
3551 \setlength{\Hy@SectionHShift}{#1}%
3552 \begingroup
3553 \toks@{\H@old@ssect{#1}{#2}{#3}{#4}}%
3554 \toks\tw@\expandafter{%
3555 \expandafter\Hy@SectionAnchorHref\expandafter{\@currentHref}%
3556 #5%
3557 }%
3558 \edef\x{\endgroup
3559 \the\toks@{\the\toks\tw@}%
3560 }\x
3561 }
3562 \let\H@old@schapter\@schapter
3563 \def\@schapter#1{%
3564 \begingroup
3565 \let\@mkboth\@gobbletwo
3566 \Hy@MakeCurrentHrefAuto{\Hy@chapapp*}%
3567 \Hy@raisedlink{%
3568 \hyper@anchorstart{\@currentHref}\hyper@anchorend
3569 }%
3570 \endgroup
3571 \H@old@schapter{#1}%
3572 }
3573 \@ifundefined{@chapter}{}{%
3574 \let\Hy@org@chapter\@chapter
3575 \def\@chapter{%
3576 \def\Hy@next{%
3577 \Hy@MakeCurrentHrefAuto{\Hy@chapapp*}%
3578 \Hy@raisedlink{%
3579 \hyper@anchorstart{\@currentHref}\hyper@anchorend
3580 }%
3581 }%
3582 \ifnum\c@secnumdepth>\m@ne
3583 \@ifundefined{if@mainmatter}%
3584 \iftrue{\csname if@mainmatter\endcsname}%
3585 \let\Hy@next\relax
3586 \fi
3587 \fi
3588 \Hy@next
3589 \Hy@org@chapter
3590 }%
3591 }
3592 \let\H@old@part\@part
3593 \begingroup\expandafter\expandafter\expandafter\endgroup
3594 \expandafter\ifx\csname chapter\endcsname\relax
3595 \let\Hy@secnum@part\z@
3596 \else
3597 \let\Hy@secnum@part\m@ne
3598 \fi
3599 \def\@part{%
3600 \ifnum\Hy@secnum@part>\c@secnumdepth
3601 \phantomsection
3602 \fi
3603 \H@old@part
3604 }
3605 \let\H@old@spart\@spart
3606 \def\@spart#1{%
3607 \Hy@MakeCurrentHrefAuto{part*}%
3608 \Hy@raisedlink{%
3609 \hyper@anchorstart{\@currentHref}\hyper@anchorend
3610 }%
3611 \H@old@spart{#1}%
3612 }
3613 \let\H@old@sect\@sect
3614 \def\@sect#1#2#3#4#5#6[#7]#8{%
3615 \ifnum #2>\c@secnumdepth
3616 \expandafter\@firstoftwo
3617 \else
3618 \expandafter\@secondoftwo
3619 \fi
3620 {%
3621 \Hy@MakeCurrentHrefAuto{section*}%
3622 \setlength{\Hy@SectionHShift}{#3}%
3623 \begingroup
3624 \toks@{\H@old@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]}%
3625 \toks\tw@\expandafter{%
3626 \expandafter\Hy@SectionAnchorHref\expandafter{\@currentHref}%
3627 #8%
3628 }%
3629 \edef\x{\endgroup
3630 \the\toks@{\the\toks\tw@}%
3631 }\x
3632 }{%
3633 \H@old@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}%
3634 }%
3635 }
3636 }{}
3637 \expandafter\def\csname Parent-4\endcsname{}
3638 \expandafter\def\csname Parent-3\endcsname{}
3639 \expandafter\def\csname Parent-2\endcsname{}
3640 \expandafter\def\csname Parent-1\endcsname{}
3641 \expandafter\def\csname Parent0\endcsname{}
3642 \expandafter\def\csname Parent1\endcsname{}
3643 \expandafter\def\csname Parent2\endcsname{}
3644 \expandafter\def\csname Parent3\endcsname{}
3645 \expandafter\def\csname Parent4\endcsname{}
3646 %%
3647 %%
3648 %%
3649 %% End of file `hgeneric.def'.