From 5dac6ccc074f72d03d874ffcf70ddc2a9b0db096 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 21 Mar 2019 20:54:17 +0000
Subject: tagpdf (21mar19)

git-svn-id: svn://tug.org/texlive/trunk@50509 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/tagpdf/tagpdf-tree-code.sty          | 28 +++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

(limited to 'Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty')

diff --git a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty
index b9667b43f75..acc72b2d668 100644
--- a/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty
+++ b/Master/texmf-dist/tex/latex/tagpdf/tagpdf-tree-code.sty
@@ -1,4 +1,4 @@
-\ProvidesExplPackage {tagpdf-tree-code} {2019/01/04} {0.50}
+\ProvidesExplPackage {tagpdf-tree-code} {2019/03/20} {0.60}
  {part of tagpdf - code related to writing trees and dictionaries to the pdf}
 
 %this does the actual finishing:
@@ -36,6 +36,31 @@
 %the ParentTree
 \__uftag_pdfreserveobjnum:N \l_tmpa_tl
 \tl_const:Nx \c__uftag_tree_obj_parenttree_tl    { \l_tmpa_tl }
+
+% we have two sets of entries in the parent tree:
+% page streams and real objects.
+% The numbers must be distinct and ordered
+% So we rely on abspage and put the real objects at the end
+% I use a counter to have a chance to get the correct number
+% if code is process twice.
+\newcounter  { g__uftag_parenttree_obj_int }
+\AtBeginDocument
+ { \int_gset:Nn \c@g__uftag_parenttree_obj_int
+   { \zref@extractdefault{LastPage}{abspage}{100}  }
+ }
+
+% we need to record the obj references:
+
+\tl_new:N \g__uftag_parenttree_objr_tl
+
+\cs_new:Nn \__uftag_parenttree_add_objr:nn %#1 Structparent number, #2 obj number
+{
+ \tl_gput_right:Nx \g__uftag_parenttree_objr_tl
+  {
+   #1 \c_space_tl #2\c_space_tl 0 \c_space_tl R\c_space_tl ^^J
+  }
+}
+
 \tl_new:N \l__uftag_parenttree_content_tl
 
 \cs_new:Nn \__uftag_tree_fill_parenttree:
@@ -92,6 +117,7 @@
    {
     \__uftag_tree_fill_parenttree:
    }
+  \tl_put_right:NV \l__uftag_parenttree_content_tl\g__uftag_parenttree_objr_tl
   \__uftag_pdfuseobjnum:xx  { \c__uftag_tree_obj_parenttree_tl }
    {
     <<\c_space_tl/Nums\c_space_tl [\l__uftag_parenttree_content_tl] \c_space_tl >>
-- 
cgit v1.2.3

