Posted by a ceTe Software moderator
Hello,
Our API doesn’t allow for duplicate form field names, when you merge PDF forms with same names, the field names are automatically renamed. It is not possible to specify a wild card to set the form field values. However, you control the renaming with the help of MergeOption.RootFormField property and set the field values using the new names.
PdfDocument pdf = new PdfDocument(@"TestForm.pdf");
MergeDocument finalDocument = new MergeDocument();
//merging the same form 10 times.
for (int i = 0; i < 10; i++)
{
MergeOptions options = new MergeOptions();
//Form fields are renamed as 1.fieldname in the first form, 2.fieldname in the second form and so on.
options.RootFormField = i.ToString();
finalDocument.Append(pdf, options);
//set the desired form field value.
string fldName = i.ToString() + "." + "Name";
finalDocument.Form.Fields[fldName].Value = "Name" + i.ToString();
}
finalDocument.Draw(@"MergedOutput.pdf");
Thanks,
ceTe Software Support Team.