简体   繁体   English

使用Acrobat Javascript API获取选定的文本

[英]Get selected text with Acrobat Javascript API

I'm trying to make a plugin written in javascript in Acrobat Pro XI. 我正在尝试制作一个用Acrobat Pro XI用javascript编写的插件。

I digged pretty much in the documentation, but founds nothing that helps me doing this simple thing. 我在文档中进行了很多挖掘,但发现没有任何东西可以帮助我完成这一简单的工作。

Is there a way to get the selected text in an open document? 有没有办法在打开的文档中获取选定的文本?

Your findings are correct. 您的发现是正确的。 (Acrobat) JavaScript has no access to "selected text" in the base document. (Acrobat)JavaScript无法访问基础文档中的“选定文本”。

A possible workaround is using the Highlight annotation. 可能的解决方法是使用“突出显示”注释。 You either set the option to show the selected text in the popup box, and then you can access it directly from JavaScript. 您可以设置选项以在弹出框中显示选定的文本,然后可以直接从JavaScript访问它。

…Or you read out the coordinates of the annotation, loop through the words of the page, compare with the coordinates and if you have a match, you have the "selected" text. …或者您读出注释的坐标,在页面中的单词之间循环,与坐标进行比较,如果有匹配项,则具有“选定”文本。

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

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