2

What are the differences between these two types of links?

    \href{xxx.pdf}{My PDF}
\href{run:xxx.pdf}{run:My PDF}

Both open the same file in Acrobat (but at different zoom levels?). However, in TeXShop, only the run: version opens the file. I have always used the second style, but as both seem to be valid, I am wondering if I need to change things?

Questions:

  1. What are the difference between these two types of links?
  2. When should I use the first style versus the second style?

Notes:

  • At this time, I am only asking regarding opening external pdf files. Having answers regarding non-pdf files (in case there are different issues involved) if fine too, as that may be useful to others.

Code:

\documentclass{article} 
\usepackage{hyperref} 

\begin{document} 
        \href{xxx.pdf}{My PDF}\quad
    \href{run:xxx.pdf}{run:My PDF}
\end{document}
1
  • 1
    run is intended to launch an application rather than open a file, I think it just happens to work if you give it a pdf file that it opens it in your default pdf viewer Commented Mar 5, 2020 at 22:07

1 Answer 1

3

Here is a slightly modified version of your document:

\documentclass{article} 
\pdfobjcompresslevel=0
\pdfcompresslevel=0
\usepackage{hyperref} 
\begin{document} 
\href{xxx.pdf}{My PDF}
\href{run:xxx.pdf}{run:My PDF}
\end{document}

You get an uncompressed PDF and therefore a readable PDF (by opening it directly in your favorite editor).

  1. The first link is coded as a GoToR action (a remote go-to action) similar to an ordinary go-to action but jumps to a destination in another PDF file instead of the current file:

    /Subtype/Link/A<</F(xxx.pdf)/S/GoToR/D[0/Fit]>>
    
  2. The second link is coded as a Launch action (to launch an external application):

    /Subtype/Link/A<</F(xxx.pdf)/S/Launch>>
    

See section 12.6.4.1, p.417-418, Document management — Portable document format — Part 1: PDF 1.7

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .