Links in TOC have incorrect alt text in PDF generated from Apache (PDF/UA-1)

Post here questions and problems related to editing and publishing DITA content.
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Links in TOC have incorrect alt text in PDF generated from Apache (PDF/UA-1)

Post by rjcbop »

We're attempting to create accessible PDF's using the default Apache engine and are using a custom fop.xconf file. In that file, we've set the following:
<accessibility>true</accessibility>

...and:
<renderer mime="application/pdf">
<pdf-ua-mode>PDF/UA-1</pdf-ua-mode>

In the generated PDF (from Oxygen 24.0), the <Link> tags associated with the table of contents entries are automatically populated with the following value for the Alternate Text property:
"No alternate text specified"

Since the TOC entries are generated from the topicrefs in our maps, we're not setting any alt text (and it doesn't appear that you even can). When a screen reader (tested with both JAWS and NVDA) reads these TOC entries, it reads this default text instead of the name of the TOC entry. If you manually remove the value of the Alternate Text property, the screen reader correctly reads the TOC entry.

Has anyone encountered this? We're wondering if there's some other setting that we can specify in the fop.xconf file that will prevent the creation of these alt text values.

Thanks for any help with this.
julien_lacour
Posts: 481
Joined: Wed Oct 16, 2019 3:47 pm

Re: Links in TOC have incorrect alt text in PDF generated from Apache (PDF/UA-1)

Post by julien_lacour »

Hello,

Until now, we haven't encountered this problem, but I added an issue on our side to see if it is possible to improve the screen readers support.
Thank you for reporting the problem.

Regards,
Julien
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Re: Links in TOC have incorrect alt text in PDF generated from Apache (PDF/UA-1)

Post by rjcbop »

Thank you!
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Re: Links in TOC have incorrect alt text in PDF generated from Apache (PDF/UA-1)

Post by rjcbop »

We've found what seems to be a very simple fix for this by overriding one of the templates in toc.xsl (from the org.dita.pdf2 plugin). Specifically, in the template that matches on *[contains(@class, ' topic/topic ')], and has mode="toc", we added the following attribute to the fo:basic-link element:
<xsl:attribute name="fox:alt-text">
<xsl:call-template name="getNavTitle" />
</xsl:attribute>
You also, of course, have to add the fox namespace (xmlns:fox="http://xmlgraphics.apache.org/fop/extensions") to the root element in your local copy of toc.xsl (we have a custom plug-in for generating PDF's).
The result is that the Alternate Text property of the Link tags for the TOC (in the PDF) are now populated with the topic title, which is then read by a screen reader.

Thanks for any comments or advice you might have on this temporary fix/workaround.
julien_lacour
Posts: 481
Joined: Wed Oct 16, 2019 3:47 pm

Re: Links in TOC have incorrect alt text in PDF generated from Apache (PDF/UA-1)

Post by julien_lacour »

Hello,

I added https://github.com/dita-ot/dita-ot/issues/3985 on DITA-OT side, eventually this will lead to a pull request with your proposed solution.
I will updated this thread once the solution will be available.

Regards,
Julien
rjcbop
Posts: 56
Joined: Wed Aug 08, 2018 10:23 pm

Re: Links in TOC have incorrect alt text in PDF generated from Apache (PDF/UA-1)

Post by rjcbop »

Hi Julien,

Thanks very much for requesting this fix on the DITA-OT side. I should note that, since I originally discovered this issue, I've found that the same issue occurs for any instance of the <fo:basic-link> element, not just TOC entries. So, for example, the same issue occurs for <fo:basic-link> elements that are generated from a DITA <xref> element.

Regards,
Rich
Post Reply