summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-06-15 03:01:03 +0000
committerNorbert Preining <norbert@preining.info>2021-06-15 03:01:03 +0000
commit2faf2507ca4d1d6d153f4c2b4c4c78479d459f06 (patch)
treee0f2305625e9b7254276aac23ed0253b6a6c0f60 /macros/latex/contrib/tagpdf/tagpdf-struct.dtx
parent269940e8e52b921a855083542b9e1109af49af09 (diff)
CTAN sync 202106150301
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-struct.dtx')
-rw-r--r--macros/latex/contrib/tagpdf/tagpdf-struct.dtx54
1 files changed, 44 insertions, 10 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
index 9e66d4913d..e385fea951 100644
--- a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
+++ b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx
@@ -2,7 +2,7 @@
%
%% File: tagpdf-struct.dtx
%
-% Copyright (C) 2019-2020 Ulrike Fischer
+% Copyright (C) 2019-2021 Ulrike Fischer
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -27,7 +27,7 @@
% \begin{macrocode}
%<@@=tag>
%<*struct>
-\ProvidesExplPackage {tagpdf-struct-code} {2021/05/14} {0.81}
+\ProvidesExplPackage {tagpdf-struct-code} {2021-06-14} {0.82}
{part of tagpdf - code related to storing structure}
% \end{macrocode}
% I will use a latex counter for the structure count
@@ -207,7 +207,7 @@
}
}
-\cs_new:Nn\@@_struct_kid_link_gput_right:nn %#1 num of parent struct, #2 obj reference
+\cs_new:Nn\@@_struct_kid_OBJR_gput_right:nn %#1 num of parent struct, #2 obj reference
{
\pdf_object_unnamed_write:nx
{ dict }
@@ -222,7 +222,7 @@
}
}
-\cs_generate_variant:Nn\@@_struct_kid_link_gput_right:nn { nx }
+\cs_generate_variant:Nn\@@_struct_kid_OBJR_gput_right:nn { nx }
\cs_new:Nn\@@_struct_exchange_kid_command:N %N= seq
{
@@ -668,11 +668,30 @@
}
-%%%% Code to tag links
+%%%% Code to tag annotations like links.
+% Annotations used as structure content must
+% (1) add a StructParent integer to their dictionary
+% (2) push the object reference as OBJR object in the structure
+% (3) Add a Stuctparent/obj-nr reference to the parent three.
+% For a link this looks like this
+% \tag_struct_begin:n { tag=Link }
+% \tag_mc_begin:n { tag=Link }
+% (1) \pdfannot_dict_put:nnx
+% { link/URI }
+% { StructParent }
+% { \int_use:N\c@g_@@_parenttree_obj_int }
+% <start link> link text <stop link>
+% (2+3) \@@_struct_insert_annot:nn {obj ref}{parent num}
+% \tag_mc_end:
+% \tag_struct_end:
+%
%%%% this works for url, see exp-link.pdf.
%%%% it must be checked for other links
-\cs_new_protected:Nn \@@_struct_finish_link:
+
+% this will probably be used for xform too, but then we can rename it.
+\cs_new_protected:Npn \@@_struct_insert_annot:nn #1 #2 %#1 object reference to the annotation/xform
+ %#2 structparent number
{
\bool_if:NT \g_@@_active_struct_bool
{
@@ -684,17 +703,18 @@
\msg_error:nn { tag } { struct-faulty-nesting }
}
%put the obj number of link annot in the kid entry:
- \@@_struct_kid_link_gput_right:nx
+ \@@_struct_kid_OBJR_gput_right:nx
{
\l_@@_struct_stack_parent_tmp_tl
}
{
- \pdfannot_link_ref_last:
+ #1 %
}
% add the parent obj number to the parent tree:
+ \exp_args:Nnx
\@@_parenttree_add_objr:nn
{
- \int_use:N\c@g_@@_parenttree_obj_int
+ #2
}
{
\prop_item:cn
@@ -706,12 +726,26 @@
}
}
+
+
+% Code to add an annot to the structure.
+% This is for example needed for widget annotations and form field
+% It reuses the command used by links
+\cs_new_protected:Npn \tag_struct_insert_annot:nn #1 #2 %#1 should be an object reference
+ %#2 struct parent num
+ {
+ \@@_struct_insert_annot:nn {#1}{#2}
+ }
+
+\cs_generate_variant:Nn \tag_struct_insert_annot:nn {xx}
+\cs_new:Npn \tag_struct_parent_int: {\int_use:c { c@g_@@_parenttree_obj_int }}
+
%</struct>
% \end{macrocode}
% \begin{macrocode}
%<*attr>
-\ProvidesExplPackage {tagpdf-attr-code} {2021/05/14} {0.81}
+\ProvidesExplPackage {tagpdf-attr-code} {2021-06-14} {0.82}
{part of tagpdf - code related to attributes and attribute classes}
% the obj is written in tagpdf-tree-code.