Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page without StructParents, syntax problem #34

Open
viktoriasee opened this issue Feb 11, 2020 · 10 comments
Open

Page without StructParents, syntax problem #34

viktoriasee opened this issue Feb 11, 2020 · 10 comments
Labels
Confirmed Yup, it's really an issue associated with accessibility.

Comments

@viktoriasee
Copy link
Collaborator

Steps to reproduce

Run this minimal example either in pdftex or lualatex:

\documentclass{scrreprt}
\usepackage{luatex85}
\usepackage[tagged]{accessibility}

\begin{document}
Text.
\end{document}

Check the output generated in PAC version 3.0.7.0
pac3-latex-accessibility-minimal_crop

You get an error page without StructParents.

Expected behaviour (correct)

The StructParents entry should be there.

@AndyClifton
Copy link
Owner

@viktoriasee I've invited you to join the project as a collaborator as you seem to have time to spend on it, and I'd appreciate some help! This might be easier than using forks and pull requests.

@viktoriasee
Copy link
Collaborator Author

I feel honoured, thanks. I indeed have some time but I am not a programmer so I need help.

\documentclass{scrreprt}
\usepackage{tagpdf}

\tagpdfsetup{activate-all}

\begin{document}
Text.
\end{document}

in pdftex creates the StructParent. Is this a hint? Maybe we should bring Ulrike Fischer on board.
structparent-minimal

@viktoriasee
Copy link
Collaborator Author

A pdf without the error like above will contain something like

<<
/Type /Page
/Contents 17 0 R
/Resources 16 0 R
/MediaBox [0 0 612 792]
/StructParents 0/Tabs/S
/Parent 21 0 R
>>

A PDF as it's produced by accessibility right now looks like this:

<<
/Type /Page
/Contents 17 0 R
/Resources 16 0 R
/MediaBox [0 0 612 792]
/Parent 21 0 R
>>

One can use tagpdf with parameter uncompress to create a human readable pdf.

@viktoriasee
Copy link
Collaborator Author

I've learned from the reference p.147 that Structparents for page objects are mandatory for a tagged PDF. They may be needed for other objects such as images too.

@AndyClifton
Copy link
Owner

AndyClifton commented Feb 16, 2020

Source of error

It looks like the general PDF object is written to PDF in accessibility.sty in lines 568 to 575:

\immediate \pdfobj useobjnum \theStructTree{%
    <</Type /StructTreeRoot %
        /RoleMap \theObjHelp \space 0 R %
        /ClassMap \theClassMap \space 0 R %
        /ParentTree <</Nums [0 [\Karray]]>> % TODO Viel komplizierter
        /ParentTreeNextKey 1 % berechnen
        /K [\Karray] %
    >>}\pdfrefobj\pdflastobj%

(and line 1032 to 1039 of the .dtx file, which is where the changes will need to be made to propagate correctly; changing the .sty file in tests/article is fine for testing)

mitigation

If I understand this right, it means that if /StructTreeRoot is page, then we need to add /StructParents 0/Tabs/S, where the value is ..

the integer key of the page's entry in the structural parent tree

And that value is defined / described in "finding structural elements from content items" on page 868 of the manual.

How to proceed

Suggested approximate steps to correct this:

  • work out where that page object is defined
  • identify what the integer value should be
  • create a new output from /StructTreeRoot that includes the correct /StructParents 0/Tabs/S

N.B. I think I understand why this was left as a "TODO"....

@AndyClifton AndyClifton added the Confirmed Yup, it's really an issue associated with accessibility. label Feb 16, 2020
@viktoriasee
Copy link
Collaborator Author

Is it really that complicated? When I add \pdfpageattr{/StructParents 0/Tabs/S} to my document preamble the error is gone.

@AndyClifton
Copy link
Owner

Ok, this could be a solution.

Could you extend the MWE with a page break and see if this fix still works, please?

@viktoriasee
Copy link
Collaborator Author

viktoriasee commented Feb 26, 2020 via email

@AndyClifton
Copy link
Owner

@viktoriasee, when you have chance, could you try one thing for me, please?

Try adding the option tagged and either flatstructure or highstructure to the call to accessibility, i.e.,

\usepackage[tagged, flatstructure]{accessibility}

and see if that changes anything?

@viktoriasee
Copy link
Collaborator Author

tagged was there already. And both highstructure or flatstructure do not make a difference. But \pdfpageattr{/StructParents 0/Tabs/S} does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed Yup, it's really an issue associated with accessibility.
Projects
None yet
Development

No branches or pull requests

2 participants