# PDF hyperlinks to a given page.

I would like a command that takes two arguments: a page number and a block of text. I would like the command to create a PDF hyperlink around the text that will jump to the given page.

I see that the undocumented \hyperpage{} command from the hyperref package will create a link to the given page, however, I don't see how it can be used to make a link for arbitrary text. I took a look at the underlying code in hyperref.sty but I can't really figure it out.

I do realize that I could use \hyperlink{}{}, but that requires I put a \hypertarget{}{} on each of the pages to be linked. In my case, I only know the numerical number of the page to be linked.

-
 I also tried the solutions listed here: tex.stackexchange.com/questions/1021/… but none seemed to apply for my problem. – ESultanik Aug 16 '10 at 19:45

You could use \hyperlink with the already defined page targets:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\newpage
text on page 2
\end{document}

-
 Thanks; that worked! I had tried \hyperlink{Page.2}{Go to page 2}, but that caused errors. I guess the "page" is case sensitive. – ESultanik Aug 16 '10 at 20:42 Yes. \hyperpage relies on those anchor names, it uses \hyperlink{page.\the\toks@}{\the\toks@} in hyperref.sty. – Stefan Kottwitz♦ Aug 16 '10 at 20:51

Not sure it is the same, but you can create a link with something like this.

First you add a label somewhere in the document.

\label{sec:listOfFiles}


\ref{sec:listOfFiles}
\pageref{sec:listOfFiles}


\usepackage{hyperref}