Hi guys,
Thanks for taking the time to look at this question for me.
So far I've been successful with all of these forms, I have been using Foxit Reader to export the .xml data from the form and then mapping it in Excel.
It appears to be caused by the embedded properties of the .xml changing from xfdf to ns1.
The blue is the text that will be imported (i.e. the text which auto-populates from the Excel source).
The "Nameofsociety" & "Placeofbirth" fields are the only fields which currently don't auto-populate. However, if I change the "ns1" to "xfdf" in the .xml it works.
<textfield19 <font="" color="#FF0000">ns1riginal="Text Field 19">DoB</textfield19>
So like in Example 1, it has changed the xfdf field to ns1 and now those fields don't populate. However, if I Find & Replace the ns1 to xfdf, it works again.
This workaround works but obviously a solution would be preferable!
I'm unsure why the .xml contains only xfdf when exported from the .pdf form but when I import into Excel, populate and then export back out it has changed some of the fields to ns1 which therefore causes that field to not work.
Either
I am also keen to learn more about why this is happening and what I can improve to prevent it from happening in future, any advice is very welcomed and appreciated!
I then map the schema myself in Excel and populate the relevant fields.
I then export from Excel a new .xml file.
I then import the new .xml back into the original .pdf which results in the form being fully filled in.
However, on some of the forms, it converts the metadata from xfdf to ns1 and those fields stop working until they are changed back into xfdf.
Anything that I can do to prevent it from changing to ns1 or an automatic way of converting them back would be very helpful.
Thanks very much in advance for any and all the help provided!
Joe
Thanks for taking the time to look at this question for me.
The Situation
I'm trying to automatically populate multiple .pdf's from my Excel source data.So far I've been successful with all of these forms, I have been using Foxit Reader to export the .xml data from the form and then mapping it in Excel.
The Problem
I was finding some fields wouldn't populate when I imported them back into the .pdf.It appears to be caused by the embedded properties of the .xml changing from xfdf to ns1.
Example 1
When I open the .xml file which doesn't import successfully using Notepad++ I can see the below:<!--?xml <font color="#FF0000"-->version="1.0" encoding="UTF-8" standalone="yes"?>
<fields <font="" color="#FF0000">xmlns:ns1="http://ns.adobe.com/xfdf-transition/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<instrument>Guitar</instrument></fields>
<fields <font="" color="#FF0000">xmlns:ns1="http://ns.adobe.com/xfdf-transition/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<instrument>Guitar</instrument></fields>
<name>Joe Bloggs</name>
<nameofsociety <font="" color="#FF0000">ns1riginal="Name of society">America</nameofsociety>
<nationality>British</nationality>
ns1riginal="Place of birth">United Kingdom</placeofbirth>
<nameofsociety <font="" color="#FF0000">ns1riginal="Name of society">America</nameofsociety>
<nationality>British</nationality>
ns1riginal="Place of birth">United Kingdom</placeofbirth>
The blue is the text that will be imported (i.e. the text which auto-populates from the Excel source).
The "Nameofsociety" & "Placeofbirth" fields are the only fields which currently don't auto-populate. However, if I change the "ns1" to "xfdf" in the .xml it works.
Example 2
Exported from the .pdf
<textfield17 <font="" color="#FF0000">xfdfriginal="Text Field 17">Email</textfield17>
Exported from the .pdf
<textfield17 <font="" color="#FF0000">xfdfriginal="Text Field 17">Email</textfield17>
<textfield18 <font="" color="#FF0000">xfdfriginal="Text Field 18">Website</textfield18>
<textfield19 <font="" color="#FF0000">xfdfriginal="Text Field 19">DoB</textfield19>
Imported into Excel, populated and then exported back into a .xml
<textfield17 <font="" color="#FF0000">ns1riginal="Text Field 17">Email</textfield17>
<textfield18 <font="" color="#FF0000">ns1riginal="Text Field 18">Website</textfield18><textfield19 <font="" color="#FF0000">xfdfriginal="Text Field 19">DoB</textfield19>
Imported into Excel, populated and then exported back into a .xml
<textfield17 <font="" color="#FF0000">ns1riginal="Text Field 17">Email</textfield17>
<textfield19 <font="" color="#FF0000">ns1riginal="Text Field 19">DoB</textfield19>
So like in Example 1, it has changed the xfdf field to ns1 and now those fields don't populate. However, if I Find & Replace the ns1 to xfdf, it works again.
This workaround works but obviously a solution would be preferable!
I'm unsure why the .xml contains only xfdf when exported from the .pdf form but when I import into Excel, populate and then export back out it has changed some of the fields to ns1 which therefore causes that field to not work.
The Solution
I need the following to happen:
Either
A) Prevent Excel from converting the xfdf fields to ns1.
OR
B) Some automatic way to change the ns1 back to xfdf - I'm looking at using Macros in Excel, VBA (although I currently only have very limited knowledge with VBA) and Autohotkey or some kind of combination of the above to enact this solution.
Sundry
I am happy to provide a copy of the .pdf forms if people would so require, as I can't attach files quite yet please just let me know and I'll paste a link in.OR
B) Some automatic way to change the ns1 back to xfdf - I'm looking at using Macros in Excel, VBA (although I currently only have very limited knowledge with VBA) and Autohotkey or some kind of combination of the above to enact this solution.
Sundry
I am also keen to learn more about why this is happening and what I can improve to prevent it from happening in future, any advice is very welcomed and appreciated!
Summary
I am exporting a .xml from a .pdf.I then map the schema myself in Excel and populate the relevant fields.
I then export from Excel a new .xml file.
I then import the new .xml back into the original .pdf which results in the form being fully filled in.
However, on some of the forms, it converts the metadata from xfdf to ns1 and those fields stop working until they are changed back into xfdf.
Anything that I can do to prevent it from changing to ns1 or an automatic way of converting them back would be very helpful.
Thanks very much in advance for any and all the help provided!
Joe