Copy link to clipboard
Copied
I want a js script that will first run Scan & OCR from Adobe Acrobat, and then run my custom script. Here is my script
that is in
Applications/Adobe\ Acrobat\ 2020/JavaScripts/testScript.js
,I have restarted the application many times but everything is fine and I get the error
Reference error
Copy link to clipboard
Copied
Where is the call for trustedRunOCR located? Also, why do you need that function, if all it does is call another function with the same parameter?
Copy link to clipboard
Copied
PS. I'm assuming you've defined a doc-level variable called isRecognized at some point, as there's no built-in property with that name of the Document object.
Copy link to clipboard
Copied
I have testPlugin.js in Applications/Adobe\ Acrobat\ 2020/JavaScripts/
Copy link to clipboard
Copied
trustedRunOCR located in javascript debugger.
Copy link to clipboard
Copied
I can remove if(doc && doc.isRecognized) check but the problem is that console can't find the function that is in the .js file.
Copy link to clipboard
Copied
The error means your call on the function is not defined. Try adding the following line to the beginning of your script and restarting Acrobat. If the file is in the right place you should see the popup when your restart.
app.alert("Script is running");
Copy link to clipboard
Copied
The script did not start, please tell me where it should be located .js file for mac.
Copy link to clipboard
Copied
In the Javascript console execute:
app.getPath("app", "javascript");
Copy link to clipboard
Copied
I put it in the right place now the script is working, but it gives a new error
InvalidArgsError: Invalid arguments.
App.execMenuItem:7:Doc ProcessPDFButton:Exec 😞
Copy link to clipboard
Copied
I don't see a menu item with this name. How did you come by it?
Copy link to clipboard
Copied
That menu item does not exist. Run the following script in the console:
app.listMenuItems();
Then copy what it returns to a text editor and search OCRRegcognize. The menu item names aren't always what you think they are. Also search Scan and if found, look inside the array for a potential name. You can test in the console by running:
app.execMenuItem("TheNameToTest");
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more