Bug 140617 - PDF export does not recognize the alternative description for a hyperlink
Summary: PDF export does not recognize the alternative description for a hyperlink
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: PDF-Accessibility
  Show dependency treegraph
Reported: 2021-02-23 09:41 UTC by SusanneMohn
Modified: 2022-12-12 18:20 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:

Example file in PAC3 (104.77 KB, image/png)
2022-12-12 18:20 UTC, Gabor Kelemen (allotropia)

Note You need to log in before you can comment on or make changes to this bug.
Description SusanneMohn 2021-02-23 09:41:33 UTC
Requirement accessebility: Provide hyperlinks with speaking text. 
PDF export does not recognize the alternative description.
Checking tool: Alternative descriptions for annotations - Annotation without alternative description. 

Steps to Reproduce:
1.Create a hyperlink in a document with a alternate description: Text: "I love Schleswig-Holstein" , Strg K: insert LINK www.schleswig-holstein.de
2.export the document to pdf
3.Check assebility with PAC 3 (Windows): 
4. Result: Annotation without alternative description. 

Actual Results:
Check the Assebility wirh PAC 3, Result: red message (error) : Page with one hyperlink with alternative description and one hyperlink without alternative description

Expected Results:
 no error to hyperlink with descriptive text

Reproducible: Always

User Profile Reset: No

Additional Info:
the software don't recognize the descriptive text
Comment 1 mulla.tasanim 2021-03-18 16:50:05 UTC
Thank you for reporting the bug. 

I can not reproduce the bug in

Version: (x64)
Build ID: d7547858d014d4cf69878db179d326fc3483e082
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nb-NO (en_US); UI: en-US
Calc: CL

Version: (x64)
Build ID: 761a672d62df1891b9f4f367a499b220ab2b33fa
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 2 Dieter 2022-03-04 17:17:28 UTC Comment hidden (obsolete)
Comment 3 Timur 2022-05-13 12:31:53 UTC
I tested in LO 7.0 and 7.4+ and really it was as reported so I put to New. 
But it's not all clear.
How do you create a hyperlink in a document with an alternate description?
URL has Text, isn't it enough? 
If not, LO has no further fields for Alt Text on link.
Comment 4 Buovjaga 2022-05-17 13:52:32 UTC
It seems PAC 3 here is behaving in a silly way and it would be harmful to uncritically follow its advice.

See this for one discussion:

Please think of the value that implementing this request would provide. To comply with PAC 3's demands, LibreOffice would have to duplicate the link text by default in the alternative description. It would just be redundant data.

World Wide Web Consortium writes: https://www.w3.org/TR/WCAG20-TECHS/PDF13.html

"The objective of this technique is to provide replacement link text via the /Alt entry in the property list for a tag. This is usually not necessary, but in some situations, additional information beyond the visible link text is needed, particularly for screen reader users."

Pay attention to "usually not necessary".
Comment 5 Buovjaga 2022-05-17 13:54:55 UTC
Well, bug 148934 comment 3 says

> The issue is purely about PDF/UA compliance, which requires a text alternative for links. (It's ridiculous, but that's what the standard requires.)

So I guess there is no other way.
Comment 6 Buovjaga 2022-05-18 13:51:54 UTC Comment hidden (obsolete)
Comment 7 Xisco Faulí 2022-05-19 07:28:20 UTC
(In reply to Buovjaga from comment #6)
> Code pointers, using alt text for images:
> vcl/source/gdi/pdfwriter_impl.cxx
> void PDFWriterImpl::setAlternateText( const OUString& rText )
> drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
> // Create image alternative description from ObjectInfoPrimitive2D info
> // for PDF export

The code is there https://opengrok.libreoffice.org/xref/core/vcl/source/gdi/pdfwriter_impl.cxx?r=e39ea45c#2103 but m_aAltText is always empty
Comment 8 Xisco Faulí 2022-05-19 07:29:09 UTC
(In reply to Xisco Faulí from comment #7)
> but m_aAltText is always empty

Sorry, this is not true
Comment 9 Christophe Strobbe 2022-05-19 11:37:42 UTC
As Buovjaga pointed out in Comment 5, this is an issue of PDF/UA compliance. (And Bug 148934 is related to this.)
The relevant requirement in ISO 14289-1 (the PDF/UA specification) is section 7.18.5, which says,

"Links shall contain an alternate description via their Contents key as described in ISO 32000-1:2008, 14.9.3."

Appendix D.2 Hyperlink Titles in ODF 1.3 Part 3 says,

"When transforming from another document format to OpenDocument the alt text of hyperlinks, shall be mapped to the office:title attribute of <text:a> 6.1.8 elements or <draw:a> 10.4.12 elements. When exporting OpenDocument documents to HTML, the contents of title text should be mapped to title attribute text on HTML anchor tags. As a minimum, authoring tools should provide a mechanism to provide the hint text."

See also subchapter 19.387 office:title, in the ODF spec:

"The office:title attribute specifies a short accessible description."

Note that the LibreOffice UI currently has no mechanism to set a Hyperlink's alt text or what the ODF spec calls the "hint text". The Hyperlink dialog has a Name field, but that maps to the attribute office:name of the text:a element. "office:name" serves as a target for other hyperlinks, so it is not the right mechanism for the hint text.

The goal of implementing this would be to come closer to PDF/UA compliance. Creating PDF/UA-compliant documents is currently almost impossible without expensive additional tools (e.g. Adobe Acrobat Pro, the Axes4 plugins for MS Office or the CommonLook plugins for MS Office), none of which are available for Linux.

One way to do this is to add a "Text alternative" field to this Hyperlink dialog which is automatically filled in with the actual link text. This would help both authors who don't know much about accessibility and those who would want to define a different alt text. The Accessibility Checker should check that links have a text alternative that is not simply a full URL.

Sidenote: The Hyperlink or Link dialog in Microsoft Word 2016 has a "Tooltip..." button ("QuickInfo..." in the German version) that allows the author to define a tooltip, but this is ignored when the DOCX file is exported to PDF. (It is not obvious whether that mapping would even be correct, but it's all MS Word has to offer in this regard.)
Comment 10 Gabor Kelemen (allotropia) 2022-12-12 18:20:11 UTC
Created attachment 184119 [details]
Example file in PAC3

I think we can consider this one fixed - this is attachment 183711 [details] from bug 151826
opened in PAC3 tool - no issue whatsoever, after the fixing of bug 148934.