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

Ross Moore ross.moore at mq.edu.au
Mon Jan 4 00:42:47 CET 2021


Hi Doug,

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

Ross -

>| 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.

Understood.  A similar problem occurs when searching for text matches, when the phrase (or even a hyphenated single word) being searched for crosses a page or other document boundary.

For now, I want only to rely on what Apple's PDFKit lets me access via their official API.  Basically, given a point on a PDFPage object, one can retrieve a PDFAnnotation object associated with that point, then query the annotation object for its bounds.  For now, it returns a single rectangle, presumably the first of several possible rectangles on different pages, though usually the only rectangle on one page.  The "delicacy" of Apple's programming in this situation isn't clear.  But for what I'm doing, I've not found any serious problems so far relying on the single bounds returned.

I actually meant for LaTeX/pdfTeX calculating the rectangle to use for an annotation,
when building the PDF ...

 … and then making that information available within a running LaTeX job.
There’s a package  zref-savepos  that writes out position information,
which can then be used on the next run. Your page output needs to have stabilised,
so that the positions can be assumed to be the same on successive runs.

Extracting from a PDF should be easy enough, at least once the contents
have been decompressed, which is presumably part of what the PDFKit does.


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/4b6f789b/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/4b6f789b/attachment-0001.png>


More information about the pdftex mailing list.