I am currently designing an interactive PDF by means of the media9 package in Latex.
I have three \mediabutton buttons that I would like to treat as toggle buttons. A picture of the buttons is shown here:
and the same array with the left button as it would appear in a toggled state is shown here:
Now, each \mediabutton is already associated with three images:
- an image to display when there is no interaction with the button,
- an image to display when the user clicks on the button.
- an image to display when the mouse hovers over the button,
All I want to do is to swap the images 1 & 3 for a button that is toggled.
I tried doing this using code such as the following:
var button = this.getField("mbtn@0"); var normal_icon = button.buttonGetIcon(0); var hover_icon = button.buttonGetIcon(2); button.buttonSetIcon(hover_icon, 0); button.buttonSetIcon(normal_icon, 1);
This just causes the button in question to disappear (or rather, it seems to lose all its images thereby appearing to be invisible).
I have tried to embed images in the PDF that I then tried to convert to Icon objects that could be attached to buttons. There appears to be no straightforward method for performing this translation though.
I would be very grateful for any pointers in how I could do this. Manual methods are not an option as our software produces reports automatically.
Thank you in advance.