Copy link to clipboard
Copied
Hi,
I have written a script in Acrobat Pro that automatically imports a .xfdf file to fill in a form. It works perfectly when I open the form in Acrobat Pro.
Here is the script:
function importXFDF()
{
var url = "C:/Users/maarmstrong/Documents/AcrobatStuff/file.xfdf";
this.importAnXFDF(url);
}
importXFDF();
However, when I try open this form in Adobe Reader, it gives the following two pop-up boxes:
The box above makes sense, just click "Allow". However, the file path looks strange to me, as if it's not pointing to the right location.
Again, the location looks odd. It should look like: C:/Users/maarmstrong/Documents/AcrobatStuff/file.xfdf
I am unsure why this is happening.
Any help will be greatly appreciated.
I managed to fix it.
All that was needed was to go into Edit>Preferences>Security(Enhanced) and uncheck "Enable Protected Mode at Starup".
Copy link to clipboard
Copied
Your syntax of the file path is incorrect. Also, you should not be declaring a variable called "url" because there's already a property with that name of the Document object, so you're creating a conflict.
Try this, instead:
function importXFDF() {
var xfdfUrl = "/C/Users/maarmstrong/Documents/AcrobatStuff/file.xfdf";
this.importAnXFDF(xfdfUrl);
}
importXFDF();
Copy link to clipboard
Copied
Hi,
I was playing around a lot and have tried this, but I get the same result.
I feel that it's a bug within Reader. If I call the function importAnXFDF() in Reader's console without specifying a file location, it brings up a file browser and I can import the file just fine. But if I call importAnXFDF("/C/Users/maarmstrong/Documents/AcrobatStuff/file.xfdf"), then I get the Access Denied error as above.
Copy link to clipboard
Copied
From the documentation of this method:
Note: If the cPath parameter is specified, this method can only be executed during batch and console events.
Copy link to clipboard
Copied
Hmm, that's odd because I've moved my file into the adobe install file and changed my script to:
function importXFDF()
{
var xfdfURL = "/C/Program Files (x86)/Adobe/Acrobat Reader DC/Reader/file.xfdf";
this.importAnXFDF(xfdfURL);
}
importXFDF();
This actually works. So I'm thinking there is some kind of permissions conflict with my users folder...
Copy link to clipboard
Copied
What do you mean by "adobe install file", exactly?
Copy link to clipboard
Copied
Sorry I meant the install location, as in where the executable lives in Program Files (x86).
I have played around more, however, and if I have the .xfdf file in "/C/Users/" I do not encounter the error. However, as soon as I put the .xfdf file into my user folder "/C/Users/maarmstrong/" I immediately encounter the error. Again, this leads me to believe there is an issue with permissions in Reader.
Copy link to clipboard
Copied
I managed to fix it.
All that was needed was to go into Edit>Preferences>Security(Enhanced) and uncheck "Enable Protected Mode at Starup".
Copy link to clipboard
Copied
That's really strange, but thanks for the update!
Copy link to clipboard
Copied
Yeah it is definitely strange, but I'm glad it's working now.
Thanks for your help!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now