I have this java Script (see below) that should work when I select all and hit Control+Enter in the Javascript console for Power PDF. However i keep getting a "ReferenceError: Application is not defined" error. How should i dim "pdDoc" as in order to assign pdDoc to the pdf file that is open?
Here is the whole Javascript code:
// 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.");
}