5

In beamer presentations produced by the LaTeX-beamer package, I usually do something like this:

\documentclass{article}

\usepackage[hidelinks]{hyperref}

\begin{document}

\href{run:myjava.jar}{Open Java Application}  
\href{run:mypdf.pdf}{Open a pdf Document}  
\href{run:myfile.custom}{Open a custom filetype}

\end{document}

When viewing the resulting pdf with evince or okular and clicking on the link my linux system opens the corresponding file using a predefined application (I guess it is the same used by gnome-open, exo-open or xdg-open).

Now is there any way to specify in my LaTeX code to use another application for a given file than the system default? Something like this:

\documentclass{article}

\usepackage[hidelinks]{hyperref}

\begin{document}

\open[...path to oracle java...]{run:myjava.jar}{Open Java Application with Oracles Java}  %%opens with oracle java  
\open[... path to openjdk java.. ]{run:myjava.jar}{Open Java Application with openjdk}
\open[..path to okular]{run:mypdf.pdf}{Open a pdf Document with okular}  
\open[..path to evince]{run:mypdf.pdf}{Open a pdf Document with evince}  
\open[...path to my custom helper application...]{run:myfile.custom}{Open a custom filetype}
\end{document}
Max N
  • 425
student
  • 29,003
  • 3
    It is not the place of a document to tell its reader what programs to use. – ctrl-alt-delor Feb 21 '15 at 13:41
  • I hope not: Being able to run an arbitrary program, with arbitrary input, is an attack vector. It would make it possible to write viruses. Therefore I don't think the pdf standard allows it. However I do know that you can embed .exe files in pdf, these files are virus prone, I know of no reader that will execute these programs, except adobe's. (beware of viruses when using adobe reader.) – ctrl-alt-delor Feb 21 '15 at 13:48
  • @richard evince and okular supports it. Since I use this technique only for my own presentations in my own laptop the security risk is not so high. But I will stress that point later on security stackexchange. – student Feb 21 '15 at 13:52
  • Have you considered changing the defaults, on your desktop? If you need more than one viewer, then can you have .pdf1, .pdf2 associated with different viewers? – ctrl-alt-delor Feb 21 '15 at 13:59
  • evince and okular supports what? (sorry your comment is unclear to me). – ctrl-alt-delor Feb 21 '15 at 14:10
  • evince and okular allow that you click on a link and open or execute the file with the corresponding standard application of your desktop. For example if I link a jar file, it will just run. – student Feb 21 '15 at 14:18
  • I am not with familiar beamer or hyperref. With that said, this might work: Your question is migrated from unix.sx and you talk of evince, hence I assume you are on a linux machine. What about wrapping the operation of opening your file with desired application in a bash script and then run the bash script in your presentation? But again, I'm not sure if this work... – Pouya Feb 23 '15 at 08:39

0 Answers0