7

I'm using XeTeX and I'd like to have a link to an attached/embedded file.

There's a solution here -- but it doesn't work for me: I'm using TeXlive2012.

As I understand it the best bet is to use attachfile2 package.

Here's an MWE:

\documentclass{article}

\usepackage[xetex]{attachfile2}

\begin{document}

\subsection{Test!}

Link: see \textattachfile{lagrange.png}{this citation}.

\end{document}

I can right-click on a link and save the file -- but it would be much nicer if I could just click the file and let the OS open it with the default application.

Edit:

If one attachs file with attachfile2 -- it behaves differenctly on different readers.

If one embeds a file:

\documentclass{article}
\usepackage{navigator}
\embeddedfile{lagrange}{lagrange.png}
\begin{document}
I attached a file -- called \texttt{lagrange.png}
\end{document}

some users won't find it.

So the most stable way is to put files to embed in a special dir, say in flz, and distribute the zip folder:

.
├── 1.pdf
└── flz
    └── lagrange.png

code:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
See \href{run:flz/lagrange.png}{here}.
\end{document}

Then it's clickable and stable.

Edit 2:

I'm using attachfile2 as posted in the first MWE.

Adobe
  • 3,037
  • 1
    It opens on double-click in Adobe Readers and asks to save on double-click in SumatraPDF. – m0nhawk Apr 29 '13 at 11:06
  • That's strange: I get no effect in okular and evince. Evince said: Couldn't open attachment “lagrange.png”: Failed to execute child process "eog" (Permission denied). It turns out that eog is an image viewer -- eye of gnome -- and I have it installed. – Adobe Apr 29 '13 at 11:32
  • It opens on double-click in Adobe Reader for me to. – Adobe Apr 29 '13 at 12:36
  • I'm not really clear on this: are you saying it's a viewer issue or something else? – Joseph Wright Aug 15 '13 at 07:57
  • @JosephWright: if one attaches with navigator it is not seen on some readers at all. If one attaches with attachfile2 it behaves a little bit differently across readers, but still accessible. If one carries file then href always work. – Adobe Aug 15 '13 at 08:38
  • @Adobe hyperref is only linking to a file, whereas both attachefile2 and navigator are actually embedding the file. The latter process sounds very much dependent on the viewer, and that sounds like what you're seeing. – Joseph Wright Aug 15 '13 at 08:42
  • @JosephWright: Yep, that's what we see. But that doesn't meen that it is imposible to embed file into a pdf in a "stable way". Although that could be a case. – Adobe Aug 15 '13 at 13:37
  • @Adobe I'm afraid it does. Different viewers implement different parts of the PDF spec in different ways. Provided they deal correctly with the display of 'static' information (text, etc.) in the way specified in the PDF standard, that variability is not an error. – Joseph Wright Aug 15 '13 at 13:46
  • I think this is a viewer issue, so it's really 'off topic' (or certainly not answerable in a positive sense) for us. – Joseph Wright Aug 03 '14 at 12:37

0 Answers0