19

Possible Duplicate:
Does hyperref work between two files?

I want to make a link in LaTeX to a PDF file on my local network drive, i.e. when you click on it then Adobe Reader should open and show the file. What I tried is the following:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\url{run:d:/my folder/test.pdf}
\end{document}

Does anyone have any suggestions?

dikdirk
  • 191

1 Answers1

24

Use \href{run:d:/my folder/test.pdf}{<link text>} instead of \url{...}:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{run:d:/my folder/test.pdf}{This is my link}
\end{document}

This works fine with Adobe Reader X (Windows).

Thorsten
  • 12,872
diabonas
  • 25,784
  • 4
    Is it possible to go to a certain page, just like the internal links? – Gqqnbig May 04 '13 at 08:04
  • This syntax works at best not only with pdfs but also with other files extensions (e.g. Matlab figure files, etc.). – MattAllegro Aug 31 '14 at 21:05
  • took me a while to make this work; finally noticed that a leading "/" on the file path seems to be not allowed. That is, I was using something like \href{run:/d:/...} and that was not working. – zkurtz Oct 29 '14 at 14:44
  • According the this reference, the leading "/" IS allowed. – Digger Feb 21 '16 at 21:55
  • 2
    It doesn't work for me on Adobe Reader XI. The link is littered with %20, %22 etc that prevent the hyperlink from pointing to the right file – Argyll May 09 '16 at 21:20
  • Is there any explanation on why that run: prefix is needed? In my tests without that prefix it works well in most readers. But the TexLive built-in PDF reader/preview e.g. does not open the file if you prepend the path with run:. Without the prefix, it seems to work in many readers, too. – rugk Jun 09 '20 at 16:53
  • @Gqqnbig You can add #page=nn to the .pdf filename, and a browser should open it and go to that page nn. – user127421 Nov 29 '22 at 01:00