Skip to content

Commit

Permalink
add fallback if indexed objects are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Apr 11, 2024
1 parent f121ca5 commit 9484f42
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tagpdf-backend.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,13 @@ end
% The return value is |n 0 R|, if the object doesn't exist, n is 0.
% \begin{macrocode}
local function @@_pdf_object_ref (name,index)
local object = ltx.pdf.object_id (name,index) ..' 0 R'
local object
if ltx.pdf.object_id then
object = ltx.pdf.object_id (name,index) ..' 0 R'
else
local tokenname = 'c__pdf_object_'..name..'/'..index..'_int'
object = token.create(tokenname).mode ..' 0 R'
end
return object
end
ltx.@@.func.pdf_object_ref = @@_pdf_object_ref
Expand Down
27 changes: 27 additions & 0 deletions tagpdf.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,34 @@
}
%</base>
% \end{macrocode}
% \subsection{Indexed objects}
% 2024-04-11: Temporary code! Can be removed after the next expl3 release!
% \begin{macrocode}
\cs_if_free:NT \pdf_object_new_indexed:nn
{
\cs_generate_variant:Nn \pdf_object_new:n {e}
\cs_generate_variant:Nn \pdf_object_write:nnn {enn}
\cs_new_protected:Npn \pdf_object_new_indexed:nn #1 #2
{
\pdf_object_new:e {#1/\int_eval:n{#2}}
}
\cs_new_protected:Npn \pdf_object_write_indexed:nnnn #1 #2 #3 #4
{
\pdf_object_write:enn {#1/\int_eval:n{#2}}{#3}{#4}
}
\cs_generate_variant:Nn \pdf_object_write_indexed:nnnn {nnne}
\cs_new:Npn\pdf_object_ref_indexed:nn #1 #2
{
\pdf_object_ref:e {#1/\int_eval:n{#2}}
}
\cs_new:Npn \__kernel_pdf_object_id_indexed:nn #1 #2
{
\int_use:c
{ c__pdf_object_ #1/\int_eval:n{#2} _int }
}
}

% \end{macrocode}
% \subsection{a LastPage label}
% See also issue \#2 in Accessible-xref
% \begin{macro}{\@@_lastpagelabel:}
Expand Down

0 comments on commit 9484f42

Please sign in to comment.