Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
  • EO.WebBrowser
  • EO.Wpf
  • Common Topics
  • Reference
    • .NET API Reference
      • EO.Base
      • EO.Base.UI
      • EO.Extensions
      • EO.Pdf
        • EO.Pdf
        • Classes
          • ClientCertificate Class
          • HtmlDocument Class
          • HtmlElement Class
          • HtmlNode Class
          • HtmlTextNode Class
          • HtmlToPdf Class
          • HtmlToPdfException Class
          • HtmlToPdfOptions Class
          • HtmlToPdfResult Class
          • HtmlToPdfSession Class
          • PageInfo Class
          • PageInfoCollection Class
          • PageStyle Class
          • Paginator Class
          • PdfAction Class
          • PdfAttachment Class
          • PdfAttachmentCollection Class
          • PdfBookmark Class
          • PdfBookmarkCollection Class
          • PdfCheckBoxField Class
          • PdfComboBoxField Class
          • PdfDestination Class
          • PdfDocInfo Class
          • PdfDocument Class
          • PdfDocumentEventArgs Class
          • PdfDocumentSecurity Class
          • PdfField Class
          • PdfFieldCollection Class
          • PdfGenericField Class
          • PdfGoToAction Class
          • PdfJavaScriptAction Class
          • PdfLaunchAction Class
          • PdfLink Class
          • PdfListBoxField Class
          • PdfListField Class
          • PdfListItem Class
          • PdfListItemCollection Class
          • PdfObject Class
          • PdfOnOffField Class
          • PdfPage Class
          • PdfPageCollection Class
          • PdfPageEventArgs Class
          • PdfPageLocation Class
          • PdfPageRectangle Class
          • PdfPageSizes Class
          • PdfPortfolio Class
          • PdfPushButtonField Class
          • PdfRadioButtonField Class
          • PdfRadioButtonGroup Class
          • PdfRender Class
          • PdfSigner Class
          • PdfTextField Class
          • PdfUriAction Class
          • PdfViewerException Class
          • PdfViewerPreference Class
          • Runtime Class
          • YRange Class
        • Interfaces
        • Enumerations
        • Delegates
      • EO.Pdf.Acm
      • EO.Pdf.Contents
      • EO.Pdf.Drawing
      • EO.Pdf.Mvc
      • EO.Web
      • EO.WebBrowser
      • EO.WebBrowser.DOM
      • EO.WebEngine
      • EO.WinForm
      • EO.Wpf
      • EO.Wpf.Gauge
      • EO.Wpf.Gauge.Shapes
      • EO.Wpf.Primitives
      • EO.Wpf.Themes.Aero
      • EO.Wpf.Themes.Classic
      • EO.Wpf.Themes.Luna
      • EO.Wpf.Themes.Metro
      • EO.Wpf.Themes.Royale
    • JavaScript API Reference
PdfDocument.Merge Method (PdfDocument[])

Merges multiple PdfDocument objects into a single PdfDocument object.

Syntax
 public static PdfDocument Merge(
   params PdfDocument[] docs
);

Parameters

docs
A list of PdfDocument objects to be merged.

Return Value

Returns a single PdfDocument that contains all pages from each of the supplied document.

Remarks

If any of the source PdfDocument has bookmarks, the bookmarks will be merged into the result document. By default, this function appends all the root bookmark items into the result document's root bookmark item list. For example, if the first document has 3 root items and the second document has 2 root items while merging two documents, then the result document will have 5 root items.

This behavior can be changed by using placeholder bookmark items. A placeholder bookmark item is a special bookmark item that represents all bookmark items for a given document. Follow these steps to use a placeholder item:

  1. Create a placeholder bookmark item by calling PdfBookmark.CreatePlaceHolder, for example:

    //Creates a placeholder representing all bookmark
    //items for "doc2"
    PdfBookmark placeHolderForDoc2 = PdfBookmark.CreatePlaceHolder(doc2);
  2. Insert the placeholder item into the first document's bookmark tree at where you wish the target document's bookmarks to appear. For example, the following code instructs all top level bookmark items for "doc2" to appear under the first top level bookmark item of doc1.

    //Insert all bookmarks in doc2 as child nodes of the
    //first bookmark of doc1
    doc1.Bookmarks[0].ChildNodes.Add(placeHolderForDoc2);

You can use placeholder bookmark items any of the source documents that points to any other source documents. However they cannot form a circle. For example, you cannot have doc2's top level items inserted as child items of doc1 and have doc1's top level items inserted as child items of doc2 at the same time.

See Also