Forum How do I...?

Issue with hyperlinks containing anchors [bug?]

IvanGerasin
Hello!
I found an issue with hyperlinks. In my HTML I have something like:
<a href="website.com/page#anchor-to-heading">

The issue is that after converting into PDF, when I'm open it in Safari, "Preview" app on MacOs, of in some PDF viewers embedded into other sites (not browser native) the "#" symbol is gets converted to "%23" so it looks like :
<a href="website.com/page%23anchor-to-heading">

Is it bug or there is something option in configuration that help me to avoid that? I've already tried to replace # with it code "&#35;" but still nothing.
Thanks!
mikeday
Is the URL missing a http:// or https:// prefix?
IvanGerasin
Nope, it has a prefix "https://"
mikeday
It appears to be a bug in Preview on MacOS Catalina:

https://discussions.apple.com/thread/251041261

The bug should be fixed in Big Sur, apparently.
IvanGerasin
Thanks! Yeah, I saw this, but the issue is not only in Preview. I also have same problem with embedded pdf viewers on different web- sites and apps (Slack) and I'm using Chrome.
Is it possible, that generated PDFs are forcing RFC3986 as mentioned here
https://discussions.apple.com/thread/251490518 ?

Ideally it to find PDF with that kind of links, but no generated by PrinceXML - so we can identify if it is possible to find a workaround.
mikeday
I don't think that's relevant, please find attached a test case that should work in every PDF viewer aside from the broken MacOS Preview.

If you examine the PDF file you will find that the URL is represented correctly:
<</Type /Annot
/Rect [54.0000 724.4561 92.3320 737.7451]
/Border [0 0 0]
/Subtype /Link
/A <</Type /Action
/S /URI
/URI (https://www.princexml.com/doc/javascript/#event-handling)>>>>
  1. test.html0.2 kB
  2. test.pdf16.3 kB
IvanGerasin
Correct, it's not working in Preview and Safari (but works in slack viewer - weird).
Thanks for explanation.