I am experimenting a little bit with JavaScript in PDF documents generated via pdflatex.
I wonder, whether there is a method to access the event handler of Adobe Acrobat or Acrobat Reader in order to react on certain events not just within a form, but for example on page level.
Although this is not a useful example for productivity, but how it is possible, to apply JavaScript code in a .tex
file that plays a sound each time a (new) page is viewed within Acrobat Reader (or other PDF viewers if applicable)? This is connected to the page levels events Page Open/Close
.
I know, this is something like a toy occupation for me (and others), but perhaps it could be of importance to other users as well.
The various documents on JavaScript provided by Adobe give no clue, except for directly using Adobe Acrobat (;-)), which has to be bought, however.
Best Answer
The page objects in a PDF listen to page open (
/O
) and close (/C
) events.Here is an example for using JavaScript actions (
/S/JavaScript
) with these events. Requires a recentmedia9
version and Adobe Reader X: