I have good news and I have bad news.
Let's start with the good news as there is fewer of that: You can use JavaScript in PDF just like you can use JavaScript in HTML.
The bad news:
- you'll need adapt your PDF to establish a communication between the JavaScript in the PDF and the JavaScript in the HTML. Take a look at an excerpt of my book to find out how to do this. From the HTML, you can trigger a method
postMessage()
, but this message will only be understood by the PDF if the PDF contains aMessageHandler
. - It's a known issue that this doesn't work on every OS (last time I checked, it didn't work on MacOS).
- Adobe Reader shows a toolbar that allows people to save a PDF. There is no way to remove that toolbar. I've already answered this question on stackoverflow: Can I hide the Adobe floating toolbar when showing a PDF in browser? Note that the other answer refers to 'Open Parameters'. As far as I know, these parameters can make the upper toolbar in the plug-in visible/invisible, but they have no effect on the 'floating toolbar'.