summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tagpdf/tagpdf-pdftex.def
blob: af9382748e6962782f3b46f491cbbd1a6b37a541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
\ProvidesExplFile {tagpdf-pdftex.def} {2018/08/06} {0.3}
  {tagpdf driver for pdftex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% driver (pdflatex) commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% needed for \str_set_convert:Nnon
\tl_new:N \g__uftag_inputencoding_tl
\tl_gset:Nn \g__uftag_inputencoding_tl {utf8}


%literal
\cs_new:Nn  \__uftag_pdfliteral_page:n { \__uftag_tex_pdfliteral:D page { #1} }
\cs_new:Nn  \__uftag_pdfcatalog:n      { \__uftag_tex_pdfcatalog:D { #1 } }

% reserve an object num and store the number
\cs_new:Nn \__uftag_pdfreserveobjnum:N % #1 = macro name to be populated with object number
 {
  \__uftag_tex_pdfobj:D reserveobjnum
  \tl_set:Nx #1 { \int_use:N \__uftag_tex_pdflastobj:D }%
 }

% add content to an object num stored in a macro
\cs_new:Nn \__uftag_pdfuseobjnum:Nn
 {
 % #1 = macro containing the object number
 % #2 = object contents, as valid PDF
 % should #2 be filtered through  \pdfstringdef  ???
  \__uftag_tex_immediate:D \__uftag_tex_pdfobj:D useobjnum~#1~{#2}%
 }

\cs_new:Nn \__uftag_pdfuseobjnum:nn
 {
 % #1 = a number the object number
 % #2 = object contents, as valid PDF
 % should #2 be filtered through  \pdfstringdef  ???
  \__uftag_check_record_pdfobj_num:n {#1}
  \__uftag_tex_immediate:D \__uftag_tex_pdfobj:D useobjnum~#1~{#2}%
 }

% obj num of the dictionary for a page:
% the page count starts by 1
% pages can referenced before they are actually created
% no error if the page later doesn't exist
\cs_new:Nn \__uftag_store_pdfpageref:Nn
 {
 % #1 = macro name to be populated with current page object number
 % #2 = number or counter identifying the required page
  \tl_set:Nx #1 { \__uftag_tex_pdfpageref:D #2}%
 }

% a global version of the command
\cs_new:Nn \__uftag_gstore_pdfpageref:Nn
 {
  \tl_gset:Nx #1 { \__uftag_tex_pdfpageref:D #2}%
 }

\cs_new:Nn \__uftag_pdfobj:Nn
 {
 % #1 = macro name to refer to this object
 % #2 = object contents, as valid PDF
 % should #2 be filtered through  \pdfstringdef  ???
  \__uftag_tex_immediate:D \__uftag_tex_pdfobj:D { #2 }
  \tl_set:Nx #1 {\int_use:N \__uftag_tex_pdflastobj:D }%
 }

%  pdfpage**s**attr: for all pages
%% is global needed? Yes. Without it the setting is lost if issued in a group
%
\cs_new:Nn \__uftag_gset_pdfpagesattr:n
 {
  \__uftag_tex_global:D \__uftag_tex_pdfpagesattr:D { #1 }
 }

\cs_new:Nn \__uftag_gadd_pdfpagesattr:n
 {
  \exp_args:No \__uftag_gset_pdfpagesattr:n { \__uftag_tex_the:D \__uftag_tex_pdfpagesattr:D #1 }
 }

% pdfpageattr for one page
% I must avoid to overwrite other entries,
% And I must avoid to add more and more /StructParens
% do we need an immediate version??
\cs_new:Nn \__uftag_gset_pdfpageattr:n
 {
  \__uftag_tex_global:D \__uftag_tex_pdfpageattr:D  { #1 }
 }

\cs_new:Nn \__uftag_gadd_pdfpageattr:n
 {
   \exp_args:No \__uftag_gset_pdfpageattr:n { \__uftag_tex_the:D \__uftag_tex_pdfpageattr:D #1}
 }

\cs_new:Nn \__uftag_get_pdfpageattr:N
 {
  \tl_set:No #1 { \__uftag_tex_the:D \__uftag_tex_pdfpageattr:D }
 }
\cs_new:Nn \__uftag_pdfcompresslevel:n
 {
   \__uftag_tex_pdfcompresslevel:D  #1
 }

\cs_new:Nn \__uftag_pdfobjcompresslevel:n
 {
   \__uftag_tex_pdfobjcompresslevel:D #1
 }


% These commands are only aliases for pdflatex but are defined differently with luatex
% to get also lua tables.
\cs_set_eq:NN \__uftag_prop_new:N     \prop_new:N

\cs_set_eq:NN \__uftag_seq_new:N      \seq_new:N

\cs_set_eq:NN \__uftag_prop_gput:Nnn  \prop_gput:Nnn

\cs_set_eq:NN \__uftag_seq_gput_right:Nn \seq_gput_right:Nn

\cs_set_eq:NN \__uftag_seq_item:cn    \seq_item:cn

\cs_set_eq:NN \__uftag_prop_item:cn   \prop_item:cn

\cs_set_eq:NN \__uftag_seq_show:N     \seq_show:N

\cs_set_eq:NN \__uftag_prop_show:N    \prop_show:N



\endinput