Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Question:

Question: Apple's Preview doesn't handle links right in PDFs

Hi!


Recently, we've painfully discovered, that apple's Preview that's shipped with our Catalina, Version 11.0 (999.4) is not handling URL links right in the PDF. Namely urls with fragments in them (https://example.com/url#fragment) are rendered with the pound-sign/hashmark is url-encoded (https://example.com/url%23fragment which is obviously incorrect, and browsers won't re-encode it, so any urls that'd deeplink or depend on the # character are now screwed.

We worked around the issue with using URL shortener websites, not to contain the pound-sign in the embedded link, but you can imagine how a generation of users will open PDFs all around the world and find corrupt urls in them.


We tested this on earlier mac versions, with Preview v10.1 and the links work fine.

Tested with different characters (?, &, =) and it's only the # character that gets encoded to %23.


Thanks!

Alex

Posted on Jan 15, 2020 2:34 AM

Reply
Question marked as Helpful

Jan 15, 2020 6:34 AM in response to alex_on_the_web In response to alex_on_the_web


On Catalina 10.15.2, Adobe Acrobat Reader DC v2019.021.20061, on mouse-over, displays the hashtag link without percent encoding, and clicking the link works as expected.


The actual URI is stored correctly within the PDF with the '#' shown unencoded. It is the mouse over of the link displayed by Preview that shows the percent encoded URI, and it is that percent encoded URI that Preview interprets literally and fatally links too — not the actual URI stored in the PDF that it should be using.


See for yourself in the Terminal:


egrep -aC2 "\(http." /path/to/hashtag.pdf


Jan 15, 2020 6:34 AM

There’s more to the conversation

Read all replies
Question marked as Helpful

Jan 15, 2020 6:34 AM in response to alex_on_the_web In response to alex_on_the_web


On Catalina 10.15.2, Adobe Acrobat Reader DC v2019.021.20061, on mouse-over, displays the hashtag link without percent encoding, and clicking the link works as expected.


The actual URI is stored correctly within the PDF with the '#' shown unencoded. It is the mouse over of the link displayed by Preview that shows the percent encoded URI, and it is that percent encoded URI that Preview interprets literally and fatally links too — not the actual URI stored in the PDF that it should be using.


See for yourself in the Terminal:


egrep -aC2 "\(http." /path/to/hashtag.pdf


Jan 15, 2020 6:34 AM

Reply Helpful (3)

Jan 15, 2020 7:24 AM in response to VikingOSX In response to VikingOSX

I guess this is correct.


As I said, the PDF is correct, other viewers open it properly, except the version of Preview I mentioned.


I thought this topic would somehow reach apple people, but now I filed an issue for feedback, linking this thread, so I hope they'll take care of this.

Jan 15, 2020 7:24 AM

Reply Helpful (2)
User profile for user: alex_on_the_web

Question: Apple's Preview doesn't handle links right in PDFs