Approach to loop merging from same PDF?

Approach to loop merging from same PDF?

Forum member · Jul 18, 2006
I'm trying to make a series of single-page PDF letters merged into one PDF doc. Each page starts as a merge doc from an existing PDF, and the program populates the PDF forms. I've gone through all the examples: a) private ceTe.DynamicPDF.Page currentPage = null doesn't work since it can't be constructed from an existing PDF, and doesn't have Form.Fields property. string pdfPath = MapPath("../PDFs/letterhead_fullsize_try1.pdf"); MergeDocument document = new MergeDocument(pdfPath); // Create a document and set it's properties document.Creator = "InvoiceLettersReport.aspx"; document.Author = "California Secretary of State"; document.Title = "Accounts Receivable"; foreach (DataRow dr in dt) { string s; s = dr.CustomerName + "\n" + dr.CustomerAddress + "\n" + dr.CountryName; // NOTE: ACCESSING FORM FIELDS document.Form.Fields["fl-customeraddress"].Value = s; //============================================== //- NEED SOMETHING LIKE THIS SO THAT NEXT LOOP UPDATES //- THE APPENDED PAGE //============================================== document.Append(pdfPath); }

Re: Approach to loop merging from same PDF?

Support · Jul 19, 2006
Hello, You can merge same PDF document multiple times into one PDF with out any problem. If you are using the same PDF document multiple times with varying data and merging into one then it is recommended to manage the form field names for each page as it will be complicated since the form field will have same name. You can get distinct form field names by using the overloaded MergeOptions constructor and set the unique RootField name for each page. Then pass this to the MergeDocument constructor as well as to the append method. In case of using single document multiple times, it will be more efficient to use the PdfDocument object to load the PDF as it will load the PDF once and allow you to use it multiple times and pass the PdfDocument object to the MergeDocument constructor as well as the append method. Thanks, ceTe Software Support Team