Apache PDFBox - 触发器和渲染 PDF 的嵌入 JavaScript
我使用 PDFBox 库制作了一个类似于增强型 PDF 查看器的应用程序。 是否有可能与文档进行交互,特别是,我有一个用 LaTeX 自制的 PDF 文档,其中包含动画包 + JavaScript 代码,它创建了一些可以滚动某些内容的按钮。因此,我需要检查文档是否具有此类按钮(我用 LaTeX 创建)并“单击”它们,这意味着使用 PDFBox 触发操作,如果我在 Adobe Reader 中打开 PDF 并单击,则会触发该操作将鼠标放在该按钮上,PDFBox 会再次渲染 PDF,内容会稍微滚动。这可能吗?
这是我的 LaTeX 代码片段:
\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}$}}%
}%
}
也许,Tilman Hausherr 知道这一点,他在这里用 PDFBox 帮助了我很多次哈哈。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论