Acrobat JavaScript-将JavaScript页面链接转换为“真实链接", [英] Acrobat JavaScript - convert JavaScript page links to "real links"
问题描述
情况:
我有〜1,000,000个PDF文件.我正在使用Acrobat JavsScript在每个PDF中搜索某些关键字,然后通过setAction("this.pageNum = n")
给该关键字提供链接. pageNum
值n也由我的脚本生成.结果是用户可以通过单击链接直接转到第n页.
The situation:
I have ~1,000,000 PDF files. I am using Acrobat JavsScript to search for certain keywords in each of the PDFs, and then give the keyword a link by setAction("this.pageNum = n")
. The pageNum
value, n, is generated by my script, too. The result is that the user can go to page number n directly by clicking the link.
问题:
我不希望这些链接触发JavaScript操作.相反,我希望他们成为"real links"
.每个"real link"
都应指向与JavaScript操作相同的页码.原因是我希望用户能够使用不允许使用JavaScript的PDF阅读器(例如SumatraPDF或Chrome浏览器)使用链接.
The problem:
I do not want the links to trigger JavaScript actions. Instead, I want to them to be "real links"
. Each of the "real link"
should point to the same page number as the JavaScript action does. The reason is that I want users to be able to use the links with a PDF reader that does not allow JavaScript (e.g. SumatraPDF or Chrome browser).
- 如果该解决方案在Acrobat中实现,那将是理想的选择 JavaScript,以便我可以集成到脚本中.如果不可能,
- 如果该解决方案可以用Python实现,那也很好, 因为问题是我的一个更大的Python应用程序的一部分 发展.
- 如果还是不可能的话,那就是任何编程中的解决方案 语言就足够了.
- It would be ideal if the solution is implemented in Acrobat JavaScript, so that I can integrate into my script. If not possible,
- It would also be great if the solution can be implemented in Python, since the problem is part of a larger Python application I am developing.
- If still not possible, a solution in any programming language will suffice.
我尝试过的事情:
我查找了整个"JavaScript for Acrobat API参考". Link对象没有"go to page reference"
属性(与使用HTML作为类比,"a"
标记具有"href"
属性不同).在我看来,Link对象仅允许使用setAction()
方法-但是如果我错了,请纠正我.
What I have tried:
I have looked up the entire "JavaScript for Acrobat API Reference". The Link object does not have a "go to page reference"
property (unlike, using HTML as an analogy, the "a"
tag has an "href"
property). It seems to me that the Link object only allows setAction()
method - but please correct me if I am wrong.
类似的问题? 有人问过类似的问题,但是问题和答案都比较模糊(请不要冒犯,所以我要再问一次). 将PDF中的javascript链接转换为真实注释
Similar question? Someone has asked a similar question, but both the question and answer was rather vague (no offense, please), so I'm asking again. Convert javascript links in PDF to real annotations
推荐答案
最后,我使用了该站点的脚本:
At the end I used a script from this site:
http://try67.blogspot. de/2011/09/convert-javascript-links-to-real-web.html
它是一个Java工具,可以满足您的需要-如果您需要快速的解决方案.
Its a java tool which does exactly that - if you need a quick solution.
似乎JAVA将成为解释PDF内的javascript的方法. Pythons PDF确实如此
It seems that JAVA will be the approach to interpret the javascript inside the PDF. Pythons PDF does
这篇关于Acrobat JavaScript-将JavaScript页面链接转换为“真实链接",的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!