Hi,
I've tested the scenario and have noticed that, "multi-test.pdf" does not get populated when using Form.ImportXml() method. I've tried importing the data contents of "multi-test.xml" that you have shared, but no success. I've used the following code snippet.
[C#]
//Assign input and output PDF documents
Aspose.Pdf.Kit.Form form = new Aspose.Pdf.Kit.Form(@"c:\Temp\multi-test.pdf", @"c:\Temp\multi-test_filled.pdf");
//Create an XML file as a FileStream that contains the contents of the PDF document|
System.IO.FileStream xmlInputStream = new FileStream(@"c:\Temp\multi-test.xml", FileMode.Open);
//Import the values from the XML file to the PDF form
form.ImportXml(xmlInputStream);
//Save the output PDF document
form.Save();
//Close the input XML stream
xmlInputStream.Close();
It would be more appropriate, if you could share the code snippet that you are using. During my investigation, I've found that, the two occurrences of LastName field, are present as LastName[0] and LastName[1]. When you simply call the method Form.Fillfield("LastName","Mike"), it searches for the field named as "LastName" and fills in the information for the first instance which is LastName[0]. But, if you try using the following code snippet, you would notice that, both the field occurrences get filled.
[C#]
//Instantiating Aspose.Pdf.Kit.Form object giving input and output PDF files as input
Aspose.Pdf.Kit.Form form = new Aspose.Pdf.Kit.Form(@"c:\Temp\multi-test.pdf", @"c:\Temp\multi-test_filled.pdf");
//Filling a Text Field (Name)
form.FillField("LastName[1]", "Mike");
form.FillField("LastName[0]", "Mike");
//Save the output PDF document
form.Save();
The exact full name of the field can be something like topmostSubform[0].Page1[0].LastName[0] or topmostSubform[0].Page1[0].LastName[1]. Please visit the following link for information on Identifying form fields names
If it does not satisfy your query, please feel free to contact.
Nayyer Shahbaz
Support Developer, Aspose Sialkot Team
About Us Contact UsKeep in touch! We're on
Twitter and
Facebook