1

Using the following code with the packages hyperref and polyglossia to insert a link into a xelatex document, the link is not clickable, while in other applications as for example the email program it does work. Does anyone know how to solve this problem?

\documentclass[twoside,11pt,a4paper]{article}

\usepackage[xetex]{hyperref}

\usepackage{polyglossia}
\setmainlanguage[spelling=old,babelshorthands=true]{german}
\setmainfont[Mapping=textext,Renderer=ICU]{Charis SIL}

\newfontfamily\germanfont[Mapping=textext,Renderer=ICU]{Charis SIL}

\begin{document}

\href{https://hikma-online.com/wp-content/uploads/2019/05/Übersetzung-Bakker.pdf}{https://hikma-online.com/wp-content/uploads/2019/05/Übersetzung-Bakker.pdf}

\url{https://hikma-online.com/wp-content/uploads/2019/05/Übersetzung-Bakker.pdf}

\end{document}
1
  • 1
    I can't reproduce the problem, when I compile your code I get a pdf with clickable links. Maybe your pdf viewer does not support links at all? Which viewer do you use?
    – Marijn
    May 4, 2021 at 19:23

1 Answer 1

2

Url must be percent encoded in a pdf. So you will have to input it like this

\href{https://hikma-online.com/wp-content/uploads/2019/05/%C3%9Cbersetzung-Bakker.pdf}
     {https://hikma-online.com/wp-content/uploads/2019/05/Übersetzung-Bakker.pdf}

With the new pdfmanagement, which is currently in a testphase, you can also use the urlencode option, it will then create the percent encoding internally:

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
\documentclass{article}
\usepackage{hyperref}
\begin{document}


\href[urlencode]{https://hikma-online.com/wp-content/uploads/2019/05/Übersetzung-Bakker.pdf}{https://hikma-online.com/wp-content/uploads/2019/05/Übersetzung-Bakker.pdf}

\url[urlencode]{https://hikma-online.com/wp-content/uploads/2019/05/Übersetzung-Bakker.pdf}
\end{document}
4
  • Not necessarily, my viewer and browser (Evince/Firefox) correctly handle the original code to produce a link which when clicked opens the correct pdf file.
    – Marijn
    May 4, 2021 at 19:36
  • 1
    @Marijn some viewers guess correctly, but it is not reliable, believe me. May 4, 2021 at 19:37
  • all viewers I have tried work (Evince, Okular, xpdf, Firefox pdf viewer, Chrome pdf viewer). But maybe indeed other viewers will fail.
    – Marijn
    May 4, 2021 at 19:47
  • Dear Ulrike Fischer, thank you very much for these very helpful answers, they work fine! May 5, 2021 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .