[pdftex] Is hyperref link color stored in PDF file annotation data?

Ross Moore ross.moore at mq.edu.au
Sun Jan 3 23:03:40 CET 2021


Hi Doug,

On 4 Jan 2021, at 8:28 am, Doug McKenna <doug at mathemaesthetics.com<mailto:doug at mathemaesthetics.com>> wrote:

Ross -

Super thanks for such a complete answer; it's kind of what I expected, without knowing the details.  And even if the link color were distinguishable from just a common text color, it still might not be accessible using Apple's PDFKit API.

You have to separate actual PDF properties from the language used by LaTeX+ hyperref
to associate intuitive (from HTML, say) concepts with the way they are simulated.

In HTML, the anchor-text for a hyperlink becomes active; e.g., as the mouse hovers over it.

In PDF there is an annotation rectangle that is placed over the text that is to indicate the anchor.
It’s not the text itself, but this rectangle that becomes “active".

With  hyperref’s  colorlinks=false  you get those ugly rectangles, with coloured borders,
to indicate where the annotation resides.
With   colorlinks=true  LaTeX colours the underlying text and pdfTeX tells the PDF
that the borders are not to be shown.

BTW, it takes rather delicate programming to properly locate where the annotation rectangle resides
on the page. It’s even harder when the anchor text splits across 2 pages, as then you need to have
two rectangles, 1 for each page.


With Tagged PDF there is a different concept, called “structure destination”.
This does away with the need for annotations and rectangles for hyperlinking,
instead using the “structure” tree to find the “Kids”;
i.e., content leaf nodes, which have the designated structure element as parent.

This is much more like in HTML’s model of a document.
However, generating good Tagged PDF with LaTeX is *much* more difficult.
(Indeed with any software tool!)


I was experimenting to see if one could color-coordinate some interface elements in an app with the content of the PDF built with pdfLatex, with only the PDF to work with (not the LaTeX source).  The good news is that it turns out that for other reasons this wasn't the best thing to do.

This kind of thing would be much more applicable to having Tagged PDF.

The big issue here is that PDFKit doesn’t support Tagged PDFs much, so far as I’m aware.
Apple has been extremely poor at acknowledging and supporting the published standards.
Adobe’s software is much, much better for this.

Since generating Tagged PDF documents, valid for published standards, is *my* thing,
we should definitely keep in touch.


Onward, into the fog ...

Doug McKenna
Mathemaesthetics, Inc.


All the best.

Ross


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/pdftex/attachments/20210103/376fc48d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/pdftex/attachments/20210103/376fc48d/attachment-0001.png>


More information about the pdftex mailing list.