Copy link to clipboard
Copied
I have a script made in javascript that works well if I execute manually from each document.
But my need is to have this executing on each PDF file open automatically:
if (this.xfa !== undefined) {
app.alert({
cMsg: "Warning: This document contains a XFA form!",
nIcon: 2,
Title: "XFA Document Detected" });
} else {
app.alert({
cMsg: "This is a normal PDF.",
nIcon: 3,
Title: "Normal PDF"
});
}
When I have this script on javascript folder (C:\Program Files\Adobe\Acrobat DC\Acrobat\Javascripts), it doesn't work as expected and there are two behaviours happening:
I'm trying to arrange a solution for a customer that has an issue regarding PDF's that contain LiveCycle XFA forms and while Adobe doesn't provide an option to deal with PDF with XFA forms. I already suggest in Adobe's UserVoice platform.
I would like to hear from some expert if there is anyway of achieving this or if I'm in a dead spot.
Thank you!
Copy link to clipboard
Copied
No, there isn't. The folder-level scripts are executed before any file is opened, so the "this" object does not point to a document at that time. And Acrobat doesn't have a "listener" object, so this won't work, I'm afraid.
Copy link to clipboard
Copied
There is a workaround, which is to write a plug-in that runs the script when a document opens. But of course if you're going to write a plug-in, it could just do whatever the script was going to do.
Copy link to clipboard
Copied
Hi Thom,
Thank you for giving me an alternate path, that seems to be the only way to go.
I will try to understand how can I create a plugin and if it's fisable.
Thank you for both for your help and guidance!
Copy link to clipboard
Copied
Plug-ins require specialized developement software significantly more programming skills than scripting. Here's a link the plug-in developers guide.
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/plugin/index.html
Copy link to clipboard
Copied
Great explanation and justifies the behaviour I'm having!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now