简体   繁体   English

Acrobat SDK-在打开时检索PDF路径

[英]Acrobat SDK - Retrieving PDF paths on open

I want to have a script, preferably folder-level, that runs in the background. 我想要一个在后台运行的脚本,最好是文件夹级别的脚本。 Every time a PDF is opened, I want to get the file path to that PDF and save it to an array. 每次打开PDF时,我都想获取该PDF的文件路径并将其保存到数组中。 The problem is that I have not seen any action listeners in the documentation. 问题是我在文档中没有看到任何动作侦听器。 There is, however, an object called app.activeDocs that is the currently active documents. 但是,有一个名为app.activeDocs的对象,它是当前活动的文档。

var d = app.activeDocs;
var paths = new Array();

for (var i=0; i < d.length; i++) {
    paths.push(d[i].path);
}

But the catch is that, these documents are only active if opened using the app.open command and I would like it to recognize PDFs that are opened either through double-clicking the PDF or opened using file > open. 但是要注意的是,这些文档仅在使用app.open命令打开时才有效,我希望它能够识别通过双击PDF或使用“文件”>“ open”打开的PDF。

I'm wondering if this is possible to do using the Acrobat SDK. 我想知道使用Acrobat SDK是否可以做到这一点。

If I understand correctly you want to write a JavaScript that would be loaded by Acrobat upon launch and that would then be called each time a document is opened. 如果我理解正确,则需要编写一个JavaScript,该JavaScript将在启动时由Acrobat加载,并在每次打开文档时调用。

If that is the case, search for the "Event" object in the Acrobat Javascript documentation. 在这种情况下,请在Acrobat Javascript文档中搜索“事件”对象。 These events are triggered upon certain actions, one of which is document open: 这些事件是由某些操作触发的,其中之一是打开文档:

This event is triggered whenever a document is opened. When a document is opened,
the document-level script functions are scanned and any exposed scripts are executed.

This article explains about events as well and points to an example document. 本文还介绍了事件,并指向示例文档。

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

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