We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Merging documents

I am trying to import multiple existing PDFs with forms. I am able to attach as many pdfs as I want however, the form filling is not working. Below is my code that I am using.

Thanks
Chad

//////////////////
//Code starts here
//////////////////
PDFDocument doc = new PDFDocument();
doc.Pages.Remove(doc.Pages[0]);

Stream s = File.Open("form.pdf", FileMode.Open);
PDFDocument ldoc = new PDFDocument(s);
s.Close();

IPDFPage lPage; IPDFForm form;
for (int i = 0; i < 2; i++)
{
form = ldoc.Form;
form.Fields["field"].Value = "Form " + i;
form.Flatten();

for (int docPage = 0; docPage < ldoc.Pages.Count; docPage++)
{
lPage = ldoc.Pages[docPage];
doc.Pages.Add(lPage);
}
}
doc.Save("sample.pdf", Response, HttpReadType.Open);
//////////////////
//Code ends here
//////////////////

1 Reply

DK Dhivya K Syncfusion Team January 17, 2007 12:52 PM UTC

Hi Chad,

Thank you for your interest in Essential PDF.

Currently we do not have support for merging multiple forms. However, we can flatten multiple forms after filling them and the merge them all. Or we can flatten them and add pages as you have done.

I am unable to reproduce the issue with your code.

Here is a sample for your reference.
Sample:http://www.syncfusion.com/Support/user/uploads/MergeForms_2003_cf9f67a6.zip

Please take a look into it and let me know if you have any queries. Could you please provide me your sample PDF forms that you are trying to fill. This will help me investigating further on this issue.

Regards,
Dhivya.

Loader.
Live Chat Icon For mobile
Up arrow icon