我有这个 java 脚本(见下文),当我选择全部并在 Power PDF 的 Javascript 控制台中按 Control+Enter 时,它应该可以工作。但是我不断收到“ReferenceError:应用程序未定义”错误。我应该如何将“pdDoc”调暗,以便将 pdDoc 分配给打开的 pdf 文件?
这里是整个 Javascript 代码:
// Get a reference to the active document
var pdDoc = Application.ActiveDoc;
// Set the search string and parameters
var searchString = "Judgment Creditor";
var searchParams = new KHKV.FindParams();
searchParams.String = searchString;
// Find the first occurrence of the search term
var searchResults = pdDoc.Find(searchParams);
if (searchResults.Count > 0) {
var firstResult = searchResults.Item(0);
// Scroll to the first occurrence of the search term
var viewParams = new KHKV.ViewParams();
viewParams.PageNumber = firstResult.DestPageNumber;
viewParams.DestPos = firstResult.DestPos;
pdDoc.CurrentView = viewParams;
} else {
alert("Could not find \"" + searchString + "\" in the document.");
}