转换JavaScript链接在PDF真实的注解 [英] Convert javascript links in PDF to real annotations
问题描述
我们正在使用的JavaScript的PDF文件,以方便转到页..等环节,自动创建或者基于某些关键字。
We are using javascript in PDFs to facilitate the automated creation of Goto page.. etc links, or based on certain keywords.
是这样的:this.pageNum = 2
LIke this: this.pageNum = 2
这工作得很好,只要在PDF打开支持JavaScript的浏览器中。
This works fine, as long the PDF is opened inside a viewer that supports javascript.
我现在正在寻找一种方式,preferably我的Java,这些注解转换为真正的注释,那么这将是Acrobat中的可用之外。
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.
我已经做了相当长的一段研究的净为止(我想,。) - 但无法找到一种方法如何去与
I have done quite some research on the net so far (i think. ,) - but couldnt find an approach how to go on with that.
推荐答案
首先,包含JavaScript环节都是真实的注解。
First and foremost, links containing JavaScript are real annotations.
是否有可能转换取决于你试图转换的JavaScript的很多。有了这样页次= X
很简单的事情你可以找到替代,但你很快就会耗尽的选择,因为可用操作的数量是相当有限的。
Whether it is possible to convert depends a lot on the JavaScripts you attempt to convert. 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.
但已经是一个简单的方法,如设置文档级变量的值(在文档级脚本设置):
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.
这篇关于转换JavaScript链接在PDF真实的注解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!