[Tex/LaTex] Hyperlink in moderncv with acrobat reader

hyperrefmoderncvpdfurls

The hyperref in moderncv for urls and the email address cannot be opened with adobe acrobat reader. The links are working in other pdf readers. It's only an issue with moderncv opened in adobe acrobat reader. I tried to make a minimal example that shows the behavior. It is the same for \href and \url. Does anybody know a resolution?

\documentclass[11pt,a4paper]{moderncv}

\moderncvtheme[grey]{classic}
\firstname{Test}
\familyname{Test}

\begin{document}

\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{click me}}}{}{}
\cventry{2012}{test}{test}{\texttt{\url{http://www.google.com}}}{}{}

\end{document}

Best Answer

I ran into the same issue with Adobe Acrobat 9 and Acrobat X Pro on two different computers. Strangely, I did not encounter an error using TeXstudio's internal PDF viewer -- the links work as is.

I started with this MWE based on the one in the question:

\documentclass[11pt,a4paper]{moderncv}

\moderncvtheme[grey]{classic}
\firstname{Test}
\familyname{Test}

\begin{document}

\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{http://www.google.com}}}{}{}

\end{document}

When attempting to click a link using Acrobat I receive the following error:

enter image description here

I found an alternate solution based on an1234's answer: add \AtBeginDocument{\hypersetup{baseurl={}}} in the preamble (you can also add other options like colorlinks). Acrobat no longer generates the error with the fixed MWE:

\documentclass[11pt,a4paper]{moderncv}

\moderncvtheme[grey]{classic}
\firstname{Test}
\familyname{Test}

\AtBeginDocument{\hypersetup{baseurl={}}}

\begin{document}

\cventry{2012}{test}{test}{\texttt{\href{http://www.google.com}{http://www.google.com}}}{}{}

\end{document}

I think this solution is preferable since you don't have to modify the moderncv.cls file.