My Account |  Site Map | Contact Us  
 The same content in Microsoft HTML help file format is included in the download package.
Merging PDF Files

You can call PdfDocument.Merge to merge two or more PDF files into a single PDF file. The following code loads three different PDF files, then merge them into one:

//Load three different PDF files
PdfDocument doc1 = new PdfDocument(pdfFileName1);        
PdfDocument doc2 = new PdfDocument(pdfFileName2);        
PdfDocument doc3 = new PdfDocument(pdfFileName3);        

//Merge them into a single PdfDocument
PdfDocument mergedDoc = PdfDocument.Merge(doc1, doc2, doc3);

//mergedDoc is a new PdfDocument object containing all
//pages from doc1, doc2 and doc3

If any of the source PDF document contains bookmarks, then the bookmarks will be merged into the target documentation as well. By default, each source document's bookmarks are appended to the result documentation. However you can override this behavior and precisely specify the relationship and position of each source document's bookmark tree in the final bookmark tree. See the remark section for PdfDocument.Merge for more details about this feature.

Direct link to this topic