Expand my Community achievements bar.

Import xml data from a variable locations

Avatar

Level 1

Hi,

Could some please help me with a solution?

Here's what currently runs on our server. An applications runs and does:

  1. Create an unique folder
  2. Copy a fillable, reader extended form into this folder
  3. Put data in a XML-file (always same filename) and places that in the same folder
  4. Open the PDF for the user to fill in the details.

Now, the change I want to make is to import the data from the XML file into the PDF. I used a button on the form using xfa.host.importData(). This fires up a browse-for-file-box so the user can select the correct xml-file. This works!

However, as the folder from where the PDF opens, is always a different one, the browse-for-file-box opens in the wrong folder. The user does see a XML-file, but that is from a different folder. So, what I wanted is the following:

  1. The form opens
  2. The PDF imports the data from the XML file automaticly, without user intervention
  3. The user finalizes the form and saves it.

In short: How can I create a variable from the folderlocation where the pdf is opened, and merge that with the xml-filename?

Hopefully I than can use xfa.host.importData("filename.xml")

I hope someone can advise me! Thanks in advance!

2 Replies

Avatar

Level 10

Hi,

This was discussed here: http://forums.adobe.com/message/3755007#3755007.

You will need to certify the form before you deploy it. If you don't specify the folder, my experience is that it will look for the XML in the same folder as the PDF form.

Hope that helps,

Niall

Avatar

Level 1

Hi,

thanks for your responce. It sure was helpfull to have a look at that discussion. However, that article regards a defined source with a fixed path (xfa.host.importData("/c/path/to/xml/file.xml");)

There is my problem. I need to determine the path first since that changes every time. Then I want to import that file using code.

I hope my question is clear. If not, please let me know!

Regards,

Erik

By the way, I also tried opening the same pdf from different folders. Adobe Reader seems to remember where it looked previous for a XML-file. So,if there is a way to set the folder where the browse-for-file-box opens with, that would be great too!