I'm merging two pdfs. Is there a way to not change the name of the field(s) on the 2nd pdf if there is a field with the same name in the first? For example, when I merge 2 pdf's that are actually the same pdf file, the field names on the 2nd pdf are suffixed with (2). Is there a way to not have the field renamed?
I ask because I am prefilling values in the pdf and the pdf's that I will be merging will share some fields that have the same name (what I'm doing now with merging the same pdf with itself is just for testing purposes).
merged pdf field names
Re: merged pdf field names
Support · Nov 28, 2011Hello,
It’s not possible to have two form fields with the same name in a PDF document, this is the reason why the Merger adds the suffix. It is not possible to prevent this renaming of the same fields but you can control how the fields are renamed using MergeOptions.RootFormField property.
PdfDocument document1 = new PdfDocument(@"inputform.pdf");
MergeOptions opt1 = new MergeOptions();
opt1.RootFormField = "1";
MergeOptions opt2 = new MergeOptions();
opt2.RootFormField = "2";
MergeDocument document = MergeDocument.Merge(document1,opt1, document1,opt2);
document.Draw(@"test.pdf");
In the above code, set the RootFormField property to the desired string and that string will be added as a prefix to the form field name. So in the above example, the output document will have two page and all the form field names in the first page will be have a prefix of 1 and the fields on the second page will have a prefix of 2.
Thanks,
ceTe Software Support Team.