简体   繁体   English

将PDF中的javascript链接转换为真实注释

[英]Convert javascript links in PDF to real annotations

We are using javascript in PDFs to facilitate the automated creation of Goto page.. etc links, or based on certain keywords. 我们在PDF中使用javascript来促进自动创建Goto页面等链接,或基于某些关键字。

LIke this: this.pageNum = 2 喜欢这个:this.pageNum = 2

This works fine, as long the PDF is opened inside a viewer that supports javascript. 只要在支持javascript的查看器中打开PDF,就可以正常工作。

I am now looking for a way, preferably i Java, to convert these annotations to real annotations, which will then be usable outside of Acrobat. 我现在正在寻找一种方法(最好是Java)将这些注释转换为真实注释,然后可以在Acrobat之外使用。

I have done quite some research on the net so far (i think. ,) - but couldnt find an approach how to go on with that. 到目前为止,我已经在网上做了很多研究(我认为是),但是找不到继续进行下去的方法。

First and foremost, links containing JavaScript are real annotations. 首先,包含JavaScript的链接是真实的注释。

Whether it is possible to convert depends a lot on the JavaScripts you attempt to convert. 是否可以转换很大程度上取决于您尝试转换的JavaScript。 With very simple things like pageNum = x you may be able to find a replacement, but you will quickly run out of options, because the number of Actions available is rather limited. 使用诸如pageNum = x这样的非常简单的方法,您也许可以找到替代品,但是您很快就会用完所有选项,因为可用的操作数非常有限。

But already a simple construct like setting the value of a document level variable (set in a document-level script): 但是已经有一个简单的结构,例如设置文档级变量的值(在文档级脚本中设置):

var cameFrom ;

in the link or button you use to jump to another page 在链接或按钮中,用于跳转到另一个页面

camefrom = this.pageNum ;

and have a button/link to jump back to where you came from 并有一个按钮/链接可以跳回到您的来源

this.pageNum = camefrom ;

will be essentially impossible to solve programmatically. 将基本上不可能以编程方式解决。

You will also have to make many assumptions, which may work for your specific files. 您还必须做出许多假设,这些假设可能适用于您的特定文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM