[Tex/LaTex] Insert web content dynamically (Javascript?)

acrotexjavascriptpdftex

This year in my field we have a large conference overlapping with the European soccer championship. Luckily my talk does not overlap with any match, but in case it will happen in the future I was wondering if it is possible to include in a beamer presentation some Javascript magic that fetches the live results from the internet and displays them in the bottom bar.

I have researched and seen some examples of embedding JS in TeX, but everything seems to be only functions that do some simple stuff when the document is opened or when a PDF form is submitted. In particular, my questions at this point are:

  1. can I run AJAX requests inside a PDF, or are the security restrictions too tight?

  2. how do I embed code that gets called every X seconds, or whenever a new slide is presented?

  3. which packages would make my life easier in programming this?

Best Answer

Package media9 is an option.

This example displays latest FIFA news in a Flash-based RSS-Reader I found on the web. It is embedded in the footline of every slide in a beamer presentation. It doesn't seem to update the content, though. However, it is reloaded (with updated content) when moving to the next presentation slide (Acrobat Reader required).

\documentclass{beamer}
\usepackage{media9}

\setbeamertemplate{footline}{
\includemedia[
  width=\paperwidth,height=0.1\linewidth,
  activate=pageopen, deactivate=pageclose,
  flashvars={rss=http://www.fifa.com/rss/index.xml},
  url
]{}{http://rsstool.sanriotown.com/rssReader.swf}%
}

\begin{document}
\begin{frame}{Frame title}
Please concentrate on the slide content!
\end{frame}
\end{document}

↗Another example, uses SlideShow.swf (also media9) to display a life image loaded from the web.