latex3 / tagging-project

Issues related to the tagging project
https://latex3.github.io/tagging-project/
LaTeX Project Public License v1.3c
30 stars 13 forks source link

attachfile2 package incompatible #511

Open mbertucci47 opened 1 month ago

mbertucci47 commented 1 month ago

The attachfile2 package (and also the attachfile package) has some issues with the tagging code. Example:

\DocumentMetadata
  {
    lang=en-US,
    pdfversion=2.0,
    pdfstandard=ua-2,
    testphase={phase-III,title,math,table,firstaid}
  }
\documentclass{article}

\usepackage{attachfile2}
\usepackage{xcolor}

\title{attachfile2 tagging test}

\attachfilesetup{color=blue}

\begin{document}

\attachfile{example-image.pdf} % compare with below
% text\attachfile{example-image.pdf}
\noattachfile

\textattachfile{example-image-a.pdf}{This text links to a file}

\notextattachfile{This text does not link to a file}

\end{document}

With pdflatex it errors with

! pdfTeX error (pageref): invalid page number.
\__pdf_backend_pageobject_ref:n ...fpageref:D  #1 
                                                    0 R
l.20 \attachfile{example-image.pdf}

With lualatex it does not error but \attachfile gives parent-child warnings. These go away if it is preceded by something like text. Here's the structure tree with this fix.

attachfile2_struc

The "This text links to a file" disappears. I'm not sure how content representing an annotation is supposed to be tagged.

u-fischer commented 2 weeks ago

Avoiding the error is rather easy, but proper tagging support would need a generic driver, so that one can add the OBJR-objects needed for an Annot structure.