Expand my Community achievements bar.

SOLVED

Data from XML to a Table. It is NOT easy for me :-(

Avatar

Level 2
Hi friends.

I have a table with 2 rows and three colums.

Titles are in the first row and they are: Software - License - Expiration Date

And the values are supposed to be in the 2nd row.

I have a text field called "Client"

I want to have an XML file linked to my PDF file. This XML should contain all my clients database, something like this:

Alfred:

     Software: Antivirus

     License: Personal

     Expiration: 2 years

Emily:

     Software: Firewall

     License: Pro

     Expiration: 3 years


And so on with all my clients.

I need the Text Field called "Client" to show all the possible clients on my XML file (drop menu, maybe) so I can choose a client (Alfred or Emily in this example)

And most important of all....i need the table to be automatic filled in according to the choosen client.

If I choose "Alfred", then the Row number 2 should be filled in with "Antivirus-Personal-2 Years", one field in each column.

I'm really confused.

Can you help me, please? Thanks and best regards.
1 Accepted Solution

Avatar

Correct answer by
Level 10

You got it..That's will be the easier way to handle in this scenario.

Have the data populated in Acrobat and then send the file to users.

Every time there is a change in the XML data you need to re-import the XML and save the file.

When I said "hard code the values inside the PDF", means the dropdowns in the PDF will have values populated at the design time itself. You can do this either typing the values in the property or by importing the XML data from Acrobat.

I hope this helps to meet your requirements..

Let me know if you have any issues going in this approach.

Thanks

Srini

View solution in original post

10 Replies

Avatar

Level 10

The clean approach is to use predicates in the binding.

Check the below blog entry which is helpful.

http://blogs.adobe.com/formfeed/2008/10/data_binding_with_predicates.html

I put in a sample file for you as an alternative approach.

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

The XML I have used in my sample is as below. Save this XML in a file with the name "ClientData.xml". Place the XML in the same location as the PDF while testing.

<?xml version="1.0" encoding="UTF-8"?>
<clientDetails>
<client>
<clientName>Alfred</clientName>
<software>Antivirus</software>
    <license>Personal</license>
    <expiration>2 years</expiration>
</client>
<client>
<clientName>Emily</clientName>
<software>Firewall</software>
    <license>Pro</license>
    <expiration>3 years</expiration>
</client>
</clientDetails>

Thanks

Srini

Avatar

Level 2

Thank you Srini, this evening i will start to check all your information.

Thanks !

Avatar

Level 2

I have trying your example on LiveCycle and it works perfectly, everything is ok and working on preview mode.

But if I open the PDF file with Adobe Acrobat the Dropdown menu doesnt show anything, it does not work?

Do you know why?

Thanks

Avatar

Level 10

Because the form expects an input XML data.

In LiveCycle, you are passing the XML file at the time of preview. But in Acrobat since you can not pass the XML at the time opening the file, you do not have the data to populate the dropdown.

If you render this form with workbench process by passing the XML data file, then you can open the file in Acrobat with the dropdown having values in it.

If your development does not have the requirement to pass the XML at the time of render, then you need to hardcode the values to the dropdown..

Thanks

Srini

Avatar

Level 2

Ok thanks.

So I guess that i need to "join" the XML to the PDF , and that process is called "rendering the form" Is that ok?

This means that if I update my xml database then i need to render another time the form to get updated.

But do i need another software (workbench?) or..what is the easy way to render the form with the xml ?

I love your example file, i'm learning a lot of it.

I'm really really thankful.

EDIT: I've realized that i can open the form with adobe acrobat and make a link to the xml. If a save the form as a new form, then this form works fine.

Is there any cleaner approach to join xml and form? (render, workbench, etc.)

Avatar

Level 10

So I guess that i need to "join" the XML to the PDF , and that process is called "rendering the form" Is that ok?

     Srini: The service used to render is "RenderPDFForm Service". This is available on the LiveCycle serviside.

This means that if I update my xml database then i need to render another time the form to get updated.

     Srini: You create a process to pull the data from your XML database every time the form is rendered. That way it will have the latest XML info in it.

But do i need another software (workbench?) or..what is the easy way to render the form with the xml ?

     Srini: Workbench is a part of the server software which will help you to create processes using LiveCycle. (It has lot of services available)

              In your requirements,

                    If the data is not changing very frequently and

                    Every user who accesses the form get the copy of the the form with the same data

               In the above two scenarios, it would be better to hard code the values inside the PDF.

               But if your PDF data changes every time based on the user who requested it, then you need to render the form for every request using a process created in Workbench or by using the APIs provided by Adobe in your code (Java/ .Net etc).

               Hope I helped you understand the difference..  

Thanks

Srini

Avatar

Level 2

Excuse me Srini, but i cant hide that i'm very noob...

My scenario is:

One user and a not frequently changing database.

When you say "hard code the values inside the PDF" ... Do you mean coding "by hand" all the data?

We have more than 200 clients, and 9 or 10 fields per client.. It could be like coding 2000 fields inside the pdf, one by one, is that ok?

What do you think about linking pdf to xml on Adobe Acrobat and saving the pdf as a new (linked and working) form? This way seems to be easier than coding a rendering-process or hard coding all the fields.. isnt it ? Furthemore, since pdf an xml are linked I can update xml database when I need, and everything should be still working.

So thankful..

Regards.

Avatar

Correct answer by
Level 10

You got it..That's will be the easier way to handle in this scenario.

Have the data populated in Acrobat and then send the file to users.

Every time there is a change in the XML data you need to re-import the XML and save the file.

When I said "hard code the values inside the PDF", means the dropdowns in the PDF will have values populated at the design time itself. You can do this either typing the values in the property or by importing the XML data from Acrobat.

I hope this helps to meet your requirements..

Let me know if you have any issues going in this approach.

Thanks

Srini

Avatar

Level 2

Thanks Srini, you are so good!

This is what i am going to do:

- Design the form exactly the same like your example is.

- Once i have the form and the xml i will open the pdf file on Adobe Acrobat

- I will import the xml file to the opened pdf file.

- I will save the pdf (with imported xml data) file.

This way everything will work perfectly, so my question is very very very answered, thanks a lot.

However, i think that I dont understand this:


When I said  "hard code the values inside the PDF", means the dropdowns in the PDF  will have values populated at the design time itself. You can do this  either typing the values in the property or by importing the XML data  from Acrobat

"Importing the XML data from Acrobat" is not at the design time itself, right?

Thanks

Avatar

Level 10

When I say hardcode the values to the dropdown means adding the values in the Designer using the properties..(like below)

DropDown HardCode Values.jpg

Thanks

Srini