[XeTeX] XeLaTeX and \href{run:....}

Bruno Voisin bvoisin at me.com
Wed Aug 20 15:21:22 CEST 2008


Le 20 août 08 à 01:47, Benjamin Sanda a écrit :

> I'm having a problem when using hyperref and XeTeX version: 0.999.2  
> from the MikTeX 2.7 distro. I'm using the \href command to link to a  
> executable program in the pdf. Ex:
>
> \href{run:install.exe}{Install Program}
>
> I have used this method before when using pdfLaTex and it worked  
> just fine. When I take the exact same code and compile it with  
> XeLaTeX however the link does not behave the same in the resultant  
> pdf. Instead the pdf reads it as a file: link and attempts to open  
> the source in a web browser. I have compaired the actual pdf code  
> and it seems the run: dirrective is being interprited differently in  
> the XeTeX case: Ex:
>
> [...]
>
> In the pdfLaTeX case I have hyperref loaded with the "pdftex"  
> option, and in the XeTeX case the "xetex" option.
> Has anyone else encountered this issue or have any ideas?

If you look at the driver definition files for pdfTeX (hpdftex.def)  
and XeTeX (hdvipdfm.def), you'll see for pdfTeX this file includes  
code for run: links:

\def\@hyper at launch run:#1\\#2#3{% filename, anchor text linkname
[...]

while for XeTeX it includes no such code.

Then, if you look at the documented source code hyperref.pdf for the  
hyperref package -- here at /usr/local/texlive/2008/texmf-dist/doc/ 
latex/hyperref/hyperref.pdf -- you'll find in section 17 "Underlying  
basic hypertext macros":

If the URL type is 'file', pass it for local opening
[...]
if it starts 'run:', its to launch an application.
[...]
otherwise its a URL
[...]
By default, turn run: into file:
[...]

Thus it seems that, except when the driver definition file adds  
support for run: links, these links are treated as file: links. And  
looking again at hyperref.pdf, it seems only the driver files for  
pdfTeX and VTeX add this support.

Whether xdvipdfmx supports run: links and it is only the driver file  
hdvipdfm which doesn't, or whether there is some technical barrier  
prohibiting xdvipdfmx to support run: links, I've no idea. The dvipdfm  
documentation -- here /usr/local/texlive/2008/texmf/doc/dvipdfm/ 
dvipdfm.pdf -- says PDF annotation are supported in any case.

That said, personally I wouldn't like to see a PDF document containing  
links launching executable files. That seems to carry serious security  
implications.

Bruno Voisin


More information about the XeTeX mailing list