Copy link to clipboard
Copied
Hi,
We're trying to create a PDF form that lets the user import (preferably XML) data on a button click.
The following works just fine on my machine.
this.importXFAData("/c/temp/import.xml")
But when I try this on another computer it won't work, due to the path not having been added to the Enhanced Security settings.
Is there a way to achieve this without adding the path there?
Or is there even a better way to do this?
Thank you.
Copy link to clipboard
Copied
What happens when you try this on another computer?
Copy link to clipboard
Copied
Hi Bernd,
Nothing happens when I copy the file to another machine. It seems to be ignoring the javascript.
I get the following in the console:
NotAllowedError: Security settings prevent access to this property or method.
Doc.importXFAData:1:Field Button4:Mouse Up
I can see this being on purpose, but i wonder if there is a way to achieve this. I can't be the only one that needs end-users to be able to populate a form with external data.
Any advice is greatly appreciated.
PS: Wir koennen das auch in deutsch machen. Falls das einfacher ist.
Copy link to clipboard
Copied
You can try this:
this.importXFAData();
Copy link to clipboard
Copied
Hi, I haven't tested with the end user, but I'm sure it won't work for my scenario. This requires the end user to select the file manually, which I’m trying to avoid.
Copy link to clipboard
Copied
- In what application (including exact version number) are you opening the file on the other computer?
- Yes, you can drop the file-path from the code and then you'll be prompted to select it.
Copy link to clipboard
Copied
The file was created in Acrobat XI (11.0.23) and I'm sure the end user has a similar version, since these applications are deployed companywide equally.
As for dropping the path. I did that on my machine and it works, but as mentioned aboded that won't work what I'm trying to achieve. End users should not be prompted to select a file.
Please let me know, if there is another or better way to do that. I’m sure other companies have similar requirements.
Copy link to clipboard
Copied
I wonder if you're trying to use the method in Acrobat Reader?
Copy link to clipboard
Copied
That would be my guess, too... Hence my question from above.
Copy link to clipboard
Copied
Please see my response above. Thank you.
Copy link to clipboard
Copied
Using the file path in this function requires privilege. As you've noted, adding the path to the "Enhanced Security" is one way to make this work. There are several other methods, but they all require the user to do something on thier system to explicitly create a privileged context. You can read all about it here:
https://www.pdfscripting.com/public/Trust-and-Privilege-in-Acrobat-Scripts.cfm
Copy link to clipboard
Copied
I figured as much. It seemed like it would be a security concern if i had the ability to add trusted paths.
With that being clarified, is there a way to accomplish this differently? Surly I can't be the only person trying to populate pdf form fields.
Any advice is greatly appreciated.
Copy link to clipboard
Copied
There are several ways to populate PDF form fields. The best method, or at least the available options depend on the specifics of your workflow. For example, who are these users? Are they in your office? Are they remote? are they random people? What kind of devices are they using? What kind of PDF viewers are they using? Do you have any control over thier systems? Where does the data come from? That sort of thing.
You can read more about loading data into forms here:
https://www.pdfscripting.com/public/Form-Data-Handling.cfm