Expand my Community achievements bar.

Import XML data at load of PDF form

Avatar

Level 2

[Thread Edited By Adobe]

/*Don’t forget to meet and greet your fellow peers virtually by telling them about yourself here

Go ahead and to it now: https://adobe.ly/3eDnB4v */

 

Actual Question:

Not sure that this is the correct forum, but it looks like a good place to start.....

 

This is my question:

 

At this moment we use an MS Excel file that runs a macro at startup that imports fielddata from an external xml-file. So, a user that opens the Excelfile will not have to fill in customer-data that is supplied by the xml-file. It is automaticly filled. For example Customer name, address, postcode etc.

 

Now, we have created a simular form in Adobe Livecycle, but we cannot get the xml-data to be imported just like the Excelfile does.


Is it possible, and how is it done, to open a pdf-form, import data from an external xml-file, all without user interaction?

 

Hope that my question is clear. Please advise

16 Replies

Avatar

Level 10

First you need to design your PDF form in LiveCycle/ Acrobat and bind the XML structure to each of the fields. Means when you import the data, the form needs to know which XML tag value to be displayed in which field.

After the form is developed, you can use Acrobat's Import data menu item to import the XML file..

Import Data in Adobe Acrobat.jpg

Thanks

Srini

Avatar

Level 2

Thank you very much for your help! I got this far allready and that works fine. However, the end-user does not have Acrobat. And what we look for is that the end-user does not have to do a manual action to import the data. That should be automaticly done at startup of the pdf-form.

This is what we try to get:

  1. The end-user opens a pdf form
  2. When the pdf form is opened, the pdf form looks for a XML file in the same folder (XML file is created in a different proces)
  3. When the XML file is available, the data in that XML file is imported automaticly
  4. The end-user fills out the rest of the pdf-form
  5. The end-user saves the form

We sure hope that there is a way to do this. In MS Excel there is, so we expect that Adobe can do at least the same

Thanks very much!

Avatar

Level 10

You have a method in host object that can import the data to the PDF form. You can call the method in the initialize event of any of the form controls.

xfa.host.importData("<XML File name>", true);

But this works with the certified forms only. You need to certify your form before you distribute to the users..

Thanks

Srini

Avatar

Level 2

Hi Srini,

thanks a lot for this help. This looks very good. So, I will try this.

One question: Do I need an extra license or software to certify a pdf document? Where can I do that?

Thanks in advance!

Erik

Avatar

Level 10

Erik,

   Check the below sample..

   https://acrobat.com/#d=iORvrl27geMudD0HrA7JBw

   Save the below XML as BookStore.xml in your local. After you open the form, Click on the Import Data button and select the XML file from your local.

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book lang="eng">
   <title>Harry Potter</title>
   <price>29.99</price>
</book>

<book lang="sp">
   <title>Learning XML</title>
   <price>39.95</price>
</book>

</bookstore>

     This is the simplest you can do without going for the Certified form.

     Certified forms can be done by using Certificates from Adobe. You need to purchase them separately.

    If you omit the arguments in the importData()method, then you do not need to certify the documents. But the user needs to choose the XML file from their file system.

     xfa.host.importData();

Thanks

Srini

Avatar

Level 2

Hi Srini,

thanks again for this great help! Certifying seems to be no option for us. So, I am working on the browse option. In addition to that I wonder if it is possible to set the default folder before showing the browse-screen.

So, when the user clicks the button, the screen that pops up should be already be browsing in the same folder as the PDF is located. This would make it very easy for a user to select the XML-file.

Please advise in this. Thanks again!

Regards,

Erik

Avatar

Level 10

Erik,

     I do not see that option available with the importData method..I will see if there is any alternative way..

Thanks

Srini

Avatar

Level 2

I have downloaded the file and did what you said but can not get the info to import.  Does this still work.

Avatar

Level 10

Do you have this working or still need help.. If so, please explain what you are trying to achieve and what is not working..

Thanks

Srini

Avatar

Level 2

Hi,

I still am working on this item. When I download your example, and open it with the reader, no browse-popup shows. When I open it with Acrobat, the popup does show. What is the difference?

Thanks,

Erik

Avatar

Former Community Member

I believe the difference is that you need to extend the form to allow people with reader to have additional permisions. You can do this

either from reader extensions or from Acrobat itself (but there are limitations to using acrobat, eg how many times the

form can be used)

edit: i just noticed that this was mentioned before

Avatar

Level 1

hi,

I want to open the "Open File Dialog" using JavaScript to import xml data.

I've tried with  "xfa.host.importData();" but the button does not work.

There is another way to do that?

Thanks,

ChangoPlatense

Avatar

Level 1

Hi Srini,

               How to use this in Javascript for automate...

Thanks in advance

Avatar

Level 1

Hi, what kind of command is it? Can I use it in VBA? What reference i need?

Thank you

Avatar

Former Community Member

Dear Srini,

we are using Excel 2010 to store patient database. We have now designed a PDF form in Adobe designer 7.0 on which we want to pull patient details like Name, Address & contact details from the excel 2010 file and populate the fields on entering the Patient ID. OS on one of my desktop is Windows7 &  another desktop with XP servicepack 3. Please help me in creating this link. By profession i am an Ophthalmologist hence dont have much idea about connecting databases.so will need detail explanation. let me know in detail how to create the ODBC connection. Thanks in advance.

Avatar

Level 1

I have installed 30 days trail version of "Adobe Arcobat DC" (15.009.20079)

I have the XML file as well.

I don't see Import Data button.

What I want to try:

Prepare PDF template/s.

I have My Data in XML format.

I want to load this "Data" into PDF template,send it for review, if approved sign it and print.

Let me know if commercial adobe product is available for the same task.