Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Recently, I made a beamer presentation and I want to link to a pdf I have made before, but I can only link to the first page of pdf document using the command:

\href{doc/mydoc.pdf}{thedoc}

and I want to link to a specific page. Someone told me to use

\href{doc/mydoc.pdf#page.5}{thedoc}

or

\href{doc/mydoc.pdf#page=5}{thedoc}

but they don't work. Does anyone know how to do this?

share|improve this question
    
What did you do to the commas? They look rather strange. –  Caramdir Aug 4 '10 at 15:46
    
@Caramdir: that was weird; the commas and the apparent spaces were a single character. Replacing them with ', ' fixed the display. I also cleaned up the layout and language while I was at it - hope that it's okay and that I haven't changed the meaning of the question. –  Loop Space Aug 4 '10 at 15:52
    
Thank you for editting. –  TeX.pig Aug 4 '10 at 16:55
    
    
\href{doc/mydoc.pdf\#page.5}{thedoc} –  Alexander Zeng Jun 19 at 6:08
add comment

3 Answers 3

up vote 9 down vote accepted

All hyperref/pdfLaTeX can do is insert a link of a certain form. It's up to the PDF viewer what to do with that link, and I don’t think there’s a standard link format for pages of external PDF files. Even if some viewers have implemented something for this, it wouldn’t be a robust solution.

My suggestion would be to actually include the linked-to PDF in the PDF you’re creating, and then you can use features of the pdfpages package to insert hyperlink targets for the included pages, and then you can use internal links. A quick example:

\documentclass{article}
\usepackage{pdfpages}
\usepackage{hyperref}
\begin{document}
Here's a \hyperlink{included.pdf.2}{link to to page 2 of the included pdf}.
\includepdf[pages=1-5,link=true]{included.pdf}
\end{document}

With beamer, at the end, you probably want something like:

{
\beamertemplatenavigationsymbolsempty
\setbeamercolor{background canvas}{bg=}
\includepdf[pages=1-5,link=true,fitpaper]{included.pdf}
}

so that the included PDF fits the paper size of the original for the included pages, and beamer's background color and navigation bars are suppressed on those pages.

share|improve this answer
    
Thank you,It must include the page in the beamer。 so it is not the best。 Thank you too! –  TeX.pig Aug 5 '10 at 5:51
add comment

Meanwhile package hyperref (must be loaded) has changed and allows now links to a special page of a pdf files with the command:

\href[page=5]{./doc/mydoc.pdf}{thedoc, page 5}

If you click the link "thedoc, page 5" your file mydoc.pdf is showed starting with page 5.

share|improve this answer
    
Does this work only if the document is compiled using pdflatex, and that the external pdf document is saved in one's hard drive? I've tried linking to a document hosted on a website (my default browser is Chrome), but it still opens to the first page. Also, when I compile using Bakoma, which doesn't use pdflatex, this trick doesn't work anymore. –  Kevin C Mar 29 '13 at 1:06
1  
@KevinC I just tried it with a pdf on a german website, compiled with pdflatex. If you view the result with adobe acrobat it works, if you view it with SumatraPDF, the wanted page is not showed, but the extern pdf file is shown starting with page 1. So what you see depends on your pdf viewer. I do not know what Bakoma does, as far as I know pdflatex is needed. –  Kurt Mar 29 '13 at 2:05
add comment

Try \hyperref{doc/mydoc.pdf}{page}{5}{thedoc}.

share|improve this answer
    
It doesn't work. Does it need special package? Or the pdf need a special process. –  TeX.pig Aug 4 '10 at 16:53
    
Which pdf viewer are you using? This will probably not work with every viewer. –  Caramdir Aug 4 '10 at 17:56
    
The target PDF also needs to support this. So if it is a LaTeX document it must be compiled with hyperref enabled. –  Caramdir Aug 4 '10 at 18:01
    
It seems to work in adobe reader, not in evince. I am compiling with pdflatex. You need to load the hyperref package, but beamer should be doing that for you. –  Jan Hlavacek Aug 4 '10 at 20:13
    
I use Adove Reader 9, I have tried it several times ,all failed。 –  TeX.pig Aug 5 '10 at 5:37
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.