Is it possible to open PDF_A.pdf, fill the form fields, then open another instance of PDF_A.pdf, fill the form fields with different data, then merge them into one pdf? Everytime I try, only page 1 has the filled in form data. Page 2 end up being a blank copy of the PDF.
Merge Two Instances of the Same PDF?
Re: Merge Two Instances of the Same PDF?
Support · Jun 10, 2010Hello,
You can achieve your requirement without any problem. You will have to re-organize the field names when merging the same page having fields several times. Form field names should be unique. It is advised to merge all the pages first and then fill the fields using the names. Below is a sample code for your requirement.
PdfDocument pdf = new PdfDocument(@"C:\Temp\fw9AcroForm_03.pdf");
MergeOptions options;
MergeDocument document = new MergeDocument();
for (int i = 1; i < 5; i++)
{
//re-organize the field names when merging
options = new MergeOptions(true, i.ToString());
//Append the PDF first page which has form fields
document.Append(pdf, 1, 1, options);
}
//Fill the fields using the new names in the final document
document.Form.Fields["1.f1-1"].Value = "Filled in Page 1";
document.Form.Fields["2.f1-1"].Value = "Filled in Page 2";
document.Form.Fields["3.f1-1"].Value = "Filled in Page 3";
document.Form.Fields["4.f1-1"].Value = "Filled in Page 4";
document.Draw(@"C:\Temp\output.pdf");
Thanks,
ceTe Software Support Team.