I am writing a C# application that will need to read in both XFA and AcroField templates. Due to the size of the company and the number of existing PDF documents that may be hooked up to the application, picking one and going with it is out of the question.
I am currently using iTextSharp to read in the AcroFields, but it is not actually saving the changes. I made the AcroFields using the trial version of Acrobat Pro.
EDIT: (I deleted a lot of the origional post)
I have a workaround somewhat working, but I would rather not do a Deapth First Search on the XML. I also do not have it figuring out anything other than text fields yet.
public List<String> getKeys(AcroFields af)
{
XfaForm xfa = af.Xfa;
List<String> Keys = new List<string>();
foreach (var field in af.Fields)
{
Keys.Add(field.Key);
}
if (xfa.XfaPresent)
{
System.Xml.XmlNode n = xfa.DatasetsNode.FirstChild;
if (n == null) return Keys;
// drill down in to the children
while (n.FirstChild != null) { n = n.FirstChild; }
// if the node is filled in data, grab the parent
if ((n.Name.ToCharArray(0, 1))[0] == '#') n = n.ParentNode;
while ((n = n.NextSibling) != null)
{
Keys.Add(n.Name);
}
}
return Keys;
}