This document contains hierarchical XFA form, that's why you can't access form fields via Document.Form.
You could use Document.Form.XFA property for accessing to XFA fields.
Document.Form.XFA.Datasets contains field data and Document.Form.XFA.Template contains field templates (which descibes field appearance etc)
Below is an example of iteration of the XFA form fields:
//recursive function to enumerate fields
private void enumFields(XmlNode node, string path)
{
//if this node has subnodes then call this routine recursively
if (node.NodeType == XmlNodeType.Element && node.HasChildNodes)
{
string subPath;
//path for the subfield
if (path == "")
{
subPath = node.Name;
}
else
{
subPath = path + "/" + node.Name;
}
foreach (XmlNode subNode in node.ChildNodes)
{
enumFields(subNode, subPath);
}
}
//if this text node then show field information
else if (node.NodeType == XmlNodeType.Text)
{
Console.WriteLine("Field name : {0}", path);
Console.WriteLine("Value : {0}", node.Value);
}
}
public void main()
{
Document pdfDocument = new Document("inFile.pdf");
//get values from all fields
if (pdfDocument.Form.XFA != null)
{
//get field data
XmlNode data = pdfDocument.Form.XFA.Datasets;
//enumerate fields
enumFields(data, "");
}
}
You also can get/set value of the particular field using the following code:
pdfDocument.Form.XFA["F[0].P1[0].Form_EditionIdentifier_A[0]" = "NEW VALUE";
Console.WriteLine(pdfDocument.Form.XFA["F[0].P1[0].Form_EditionIdentifier_A[0]"]);