I have question regarding XeLaTeX. I have switched from LaTeX to XeLaTeX because I wanted to use ttf fonts and now I have a problem with \hyperlink. It works with text, but it doesn't with images.

So for example, when I click on the text: Dit hjem, I will go to page 2. It does not work with image.

My code:

\documentclass[landscape,a4paper,11pt]{article}
\special{papersize=297mm,210mm}

\usepackage{graphicx}
%\usepackage[pdftex]{graphicx}

\usepackage{hyperref}

\usepackage[danish]{babel}

\DeclareGraphicsExtensions{.png,.pdf,.jpg,.mps}

\usepackage[top=2cm, bottom=2cm, left=3cm, right=3cm]{geometry}
\usepackage[absolute]{textpos}
\pagestyle{empty}

\setlength{\parindent}{0pt}

\usepackage{color}

\hypersetup{
bookmarks=true,         % show bookmarks bar?
unicode=false,          % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true,        % show Acrobat’s toolbar?
pdffitwindow=false,     % window fit to page when opened
pdfstartview={FitH},    % fits the width of the page to the window
pdftitle={My title},    % title
pdfauthor={Author},     % author
pdfsubject={Subject},   % subject of the document
pdfcreator={Creator},   % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keyword1} {key2} {key3}, % list of keywords
pdfnewwindow=true,      % links in new window
citecolor=green,        % color of links to bibliography
filecolor=magenta,      % color of file links
urlcolor=cyan,           % color of external links
pdfnonfullscreenpagemode=true,
pdfborder={ 0 0 0}
}

\begin{document}

\null\newpage
Some text

\end{document}

-
Please add a minimal working example (MWE) that illustrates your problem. – egreg Oct 17 '11 at 13:16
It would be a good idea to tell us what actually doesn't work. Also don't send code snippet. Always make a complete example, if I complete your code and use one of my graphics it works fine. – Ulrike Fischer Oct 17 '11 at 13:20
In my code I have a menu with an image and a text. Both are inside \hyperlink so they link to another page in document, but only text works as a link. I cannt click on image, cause somehow it doesnt work as link. <code> <br/> \hyperlink{page.3}{\includegraphics[height=14.869mm, width=14.869mm]{images/dig_og_din_naermeste}} <br/> \hyperlink{page.3}{\textblockcolour{white}{\fontsize{3mm}{5mm} \selectfont Dig og dine n\ae rmeste}} <code> – joanna Oct 17 '11 at 13:40
You should make a small complete example. That is one that starts with \documentclass and ends with \end{document}. Use either \usepackage[demo]{graphicx} or replace the image with one available for us too e.g. with "tiger". Add the example to your question, not as comment. Also put the log-file of the compilation somewhere on the net. – Ulrike Fischer Oct 17 '11 at 13:53
I don't get any problem from your input file. – egreg Oct 17 '11 at 14:16

I was able to replicate your problem. I found a solution here: http://www.tug.org/pipermail/xetex/2005-October/002480.html

From the site:

You could possibly hack around this by wrapping your graphic
inclusion in a macro that outputs glyphs at two diagonally opposite
corners of the image; they could be small blank glyphs (e.g.,
\char32), so as not to show on the page, as long as they're real
glyphs in a font so that xdv2pdf "sees" them. I think that would
trick the driver into creating the proper link area.

Here's the command that does the work (again, from the site):

\newsavebox{\ximagebox}
\newlength{\ximageheight}
\newsavebox{\xglyphbox}
\newlength{\xglyphheight}
\newcommand{\xbox}[1]%
{\savebox{\ximagebox}{#1}%
\settoheight{\ximageheight}{\usebox{\ximagebox}}%
\savebox{\xglyphbox}{\char32}%
\settoheight{\xglyphheight}{\usebox{\xglyphbox}}%
\raisebox{\ximageheight}[0pt][0pt]{\raisebox{-\xglyphheight}[0pt][0pt]{%
\makebox[0pt][l]{\usebox{\xglyphbox}}}}%
\usebox{\ximagebox}%
\raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}


To be used as

\hyperlink{page.2}{\xbox{\includegraphics[height=14cm, width=14cm]{tiger}}}


Complete MWE follows:

\documentclass[landscape,a4paper,11pt]{article}
\special{papersize=297mm,210mm}

\usepackage{graphicx}
%\usepackage[pdftex]{graphicx}

\usepackage{hyperref}

\usepackage[danish]{babel}

\DeclareGraphicsExtensions{.png,.pdf,.jpg,.mps}

\usepackage[top=2cm, bottom=2cm, left=3cm, right=3cm]{geometry}
\usepackage[absolute]{textpos}
\pagestyle{empty}

\setlength{\parindent}{0pt}

\usepackage{color}

\hypersetup{
bookmarks=true,         % show bookmarks bar?
unicode=false,          % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true,        % show Acrobat’s toolbar?
pdffitwindow=false,     % window fit to page when opened
pdfstartview={FitH},    % fits the width of the page to the window
pdftitle={My title},    % title
pdfauthor={Author},     % author
pdfsubject={Subject},   % subject of the document
pdfcreator={Creator},   % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keyword1} {key2} {key3}, % list of keywords
pdfnewwindow=true,      % links in new window
citecolor=green,        % color of links to bibliography
filecolor=magenta,      % color of file links
urlcolor=cyan,           % color of external links
pdfnonfullscreenpagemode=true,
pdfborder={ 0 0 0}
}

\newsavebox{\ximagebox}
\newlength{\ximageheight}
\newsavebox{\xglyphbox}
\newlength{\xglyphheight}
\newcommand{\xbox}[1]%
{\savebox{\ximagebox}{#1}%
\settoheight{\ximageheight}{\usebox{\ximagebox}}%
\savebox{\xglyphbox}{\char32}%
\settoheight{\xglyphheight}{\usebox{\xglyphbox}}%
\raisebox{\ximageheight}[0pt][0pt]{\raisebox{-\xglyphheight}[0pt][0pt]{%
\makebox[0pt][l]{\usebox{\xglyphbox}}}}%
\usebox{\ximagebox}%
\raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}

\begin{document}


XeTeX doesn't use xdv2pdf` any more on Mac OS X. I couldn't replicate the problem. – egreg Oct 17 '11 at 23:20