I want to have a flash file (.swf
) in my beamer
document on a Linux machine, using pdfLaTeX and Evince.
Is there a way to make a link to that file which runs an external player or even better, is it possible to embed it into my presentation?
For the first option I tried
\href{run:/usr/bin/gnash /tmp/test.swf}{test}
which gives me the error
Failed to open "/usr/bin/gnash /tmp/test.swf"
Error stating file '/usr/bin/gnash /tmp/test.swf': No such file or directory.
(however \href{run:/usr/bin/gnash}{test}
starts just gnash).
For the second I know the flashmovie
package. However I want use Evince as PDF viewer and not Adobe Reader.
Edit:
Finally I just used \href{run:/tmp/test.swf}
. I think if you open this by Evince the correct application to open the .swf
file is chosen by gnome-open
. If you use okular
I guess it is kde-open
. To avoid possible configuration problems with those openers and to have more control, I think it would be much better to have a way to specify the application which should open my file (in my case gnash
) as I tried in my question above. So if there are any ideas …
Best Answer
This is actually to do with the PDF renderer, not TeX. I don't have
gnash
installed, nor any flash files to hand, but I tested with the following file:With
evince
then the second link opened my department homepage, as expected, but the first produced the error:So clearly
evince
is trying to launch a program in its current directory calledfirefox http://www.math.ntnu.no/
(well, modulo disappearing slashes).However, when I try this with
xpdf
, my usual PDF reader, then when I click on the link it says:and asks me if I really want to do this. If I click "OK" then I get what I expect. This experiment suggests that there is some latitude in what the viewer gets to do.
Looking at the resulting PDF file, I see the following:
(Note that the slashes are as they should be). So a
run:
directive gets converted to aLaunch
action, and anhttp:
directive to aURI
action.Looking at the PDF specs (or at least, Adobe's free copy thereof) I learnt more than I wanted to about the internals of PDFs, including launch actions. These are detailed in Section 12.6.4.5 (p422, internal numbering, p430, external). What is interesting is that some parts of this have the tag "not yet defined". Whilst I don't think that these are relevant here (as they refer to OS-specific features and these aren't used), I think that this implies that the specification here might be subject to revision as unusual use-cases appear. (Seeing this just after reading about Windows behaviour with spaces in program names is an interesting juxtaposition.)
So my inference (and it is nothing more) is that exactly what a PDF viewer does when it encounters a "Launch" action is pretty much up to that viewer. Unfortunately, this includes whether to regard the string as a single command name or to break it up. Actually, I suspect that the question is whether to pass it to the relevant
open
command (or maybe the shell) as a quoted string or not.To avoid this, I recommend writing a small script that calls the flash viewer on your program. Something like:
and then call that from within your file.
With a bit of
\write
trickery, you could even gettex
to create that file itself.