Vairis has shown in his answer, that XeTeX has some problems, if the link does not
contain character glyphs. LaTeX's picture environment uses glyphs of a special font
for \line, \vector and \circle. This is also the reason for the limitations
(only some angles, the sizes are restricted, …). Horizontal and vertical lines
are the exception, because they are drawn by rules.
Detected by XeTeX: character glyphs.
Not detected by XeTeX: rules, images, boxes without glyphs, ...
As solution I have now implemented \XeTeXLinkBox in hyperref 2012/08/18 v6.83b, from
README:
\XeTeXLinkBox
When XeTeX generates a link annotation, it does not look at the boxes (as the other drivers), but only at the character
glyphs. If there are no glyphs (images, rules, …), then it does
not generate a link annotation. Macro \XeTeXLinkBox puts its
argument in a box and adds spaces at the lower left and upper right
corners. An additional margin can be specified by setting it to the
dimen register \XeTeXLinkMargin. The default is 2pt.
Example:
% xelatex
\documentclass{article}
\usepackage{hyperref}
\setlength{\XeTeXLinkMargin}{1pt}
\begin{document}
\section{Hello World}
\newpage
\label{sec:hello}
\hyperref[sec:hello]{%
\XeTeXLinkBox{\rule{10mm}{10mm}}%
}
\end{document}
Modified example from Vairis:
\documentclass[a4paper]{article}
\usepackage{hyperref}
\usepackage{pifont}
\makeatletter
\@ifpackagelater{hyperref}{2012/08/18}{%
}{%
\newdimen\XeTeXLinkMargin
\newsavebox\XeTeXLink@box
% Space is taken from Zapf Dingbats with zero height and depth
\font\XeTeXLink@font=pzdr at 1sp\relax
\newcommand*{\XeTeXLink@space}{%
\begingroup\XeTeXLink@font\@xxxii\endgroup
}
\newcommand{\XeTeXLinkBox}[1]{%
\begingroup
\leavevmode
\sbox0{#1}%
\begingroup
\dimen0=\dp0 %
\advance\dimen0 by \XeTeXLinkMargin
\setbox2=\llap{%
\hbox to \XeTeXLinkMargin{%
\lower\dimen0\hbox{\XeTeXLink@space}%
\hss
}%
}%
\dp2=\dp0 %
\ht2=\ht0 %
\copy2 %
\endgroup
\copy0 %
\dimen0=\ht0 %
\advance\dimen0 by \XeTeXLinkMargin
\setbox2=\rlap{%
\hbox to \XeTeXLinkMargin{%
\hss
\raise\dimen0\hbox{\XeTeXLink@space}%
}%
}%
\dp2=\dp0 %
\ht2=\ht0 %
\copy2 %
\endgroup
}%
}
\makeatother
\setlength{\XeTeXLinkMargin}{2pt}
\begin{document}
\phantomsection \label{PP1}
First page \newpage
\phantomsection \label{PP2}
Second page \newpage
\centering
\hyperref[PP1]{\line(1,1){10}}
\qquad
\hyperref[PP1]{\vector(1,0){10}}
\qquad
\hyperref[PP2]{%
\XeTeXLinkBox{%
\begin{picture}(10,10)%
\put(5,10){\line(0,-1){10}}%
\end{picture}%
}%
}
\qquad
\hyperref[PP2]{%
\begin{picture}(10,10)%
\put(5,10){\XeTeXLinkBox{\line(0,-1){10}}}%
\end{picture}%
}
\qquad
\hyperref[PP1]{\XeTeXLinkBox{\line(1,0){10}}}
\end{document}
Result:

The reason for using the space from Zapf Dingbats are:
- There is a space glyph.
- Package
pifont is already loaded, therefore the fonts are very likely installed.
- The height and depth of the space glyph is zero.
- The width is minimized by loading the font at the size of
1sp.
\hyperlink{PP1}{\hbox{\line(1,0){50}}}it works well. – Marco Daniel May 21 '12 at 18:23\hyperref[PP1]{\line(1,0){1}}command works. But I have to use XeLaTeX instead. So, the problem is how do I make this command work on XeLaTeX? – Nina May 21 '12 at 18:37