'Apache PDFBox - trigger & render embedded JavaScript of PDF

I made an application like an enhanced PDF viewer using PDFBox library. Is there a possibility to interact with a document, in particular, I have a self crafted PDF document in LaTeX with animate package + JavaScript code, that creates kinda buttons that enable to scroll some content. So, I would need to check if the document has these kind of buttons (I created with LaTeX) and to "click" them, meaning to trigger the action using PDFBox that would be triggered if I opened the PDF in Adobe Reader and clicked with the mouse on this button, such that PDFBox then renders the PDF again with the content being scrolled a bit. Is this possible?

Here is my LaTeX code fragment:

\newcommand\botScrollButton[1]{%
    \mediabutton[
    jsaction={
        if(event.shift){anim['#1'].pause();anim['#1'].frameNum=anim['#1'].numFrames-1;}
        else try{anim['#1'].frameNum+=10}catch(e){}
    }
    ]{\fboxsep=0pt\framebox[\widthof{\xusebox{#1}}][c]{%
            \tiny\strut\raisebox{0.1\height}{$\underline{\vee\vee\vee}$}}%
    }%
}  

Maybe, Tilman Hausherr knows this, he helped me quite a few times with PDFBox on here haha.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source