Table of Contents

Method AppendPages

Namespace
PdfSharp.Pdf
Assembly
PdfSharp.dll

AppendPages(PdfDocument)

Appends all pages of a document opened with Import, with their form fields, bookmarks and links. See AppendPages(PdfDocument, int, int, PdfPageImportOptions).

public PdfPageImportResult AppendPages(PdfDocument source)

Parameters

source PdfDocument

Returns

PdfPageImportResult

AppendPages(PdfDocument, PdfPageImportOptions)

Appends all pages of a document opened with Import, with their form fields, bookmarks and links. See AppendPages(PdfDocument, int, int, PdfPageImportOptions).

public PdfPageImportResult AppendPages(PdfDocument source, PdfPageImportOptions options)

Parameters

source PdfDocument
options PdfPageImportOptions

Returns

PdfPageImportResult

AppendPages(PdfDocument, int, int)

Appends pages of a document opened with Import, with their form fields, bookmarks and links. See AppendPages(PdfDocument, int, int, PdfPageImportOptions).

public PdfPageImportResult AppendPages(PdfDocument source, int startIndex, int pageCount)

Parameters

source PdfDocument
startIndex int
pageCount int

Returns

PdfPageImportResult

AppendPages(PdfDocument, int, int, PdfPageImportOptions)

Appends pages of a document opened with Import, with their form fields, bookmarks and links, for merging documents. Unlike AddPage(PdfPage):

  • Form fields with a widget on an appended page are added to this document's form, so they can be filled or flattened, with the font, size and colour their own form gave them. A field whose name this document already uses is renamed name_2, name_3 and so on; RenamedFields lists the new names.
  • Links, the GoTo actions of buttons and other annotations, and bookmarks lead to the appended pages. Named destinations are written as the explicit destinations they name. A link to a page that is not appended is removed, as is such an action; a bookmark to such a page is removed unless it holds bookmarks that are kept. Links and bookmarks that lead elsewhere, such as a web address, are kept.
  • Annotations do not pull in hidden copies of other pages.

Append a source in one call: pages appended in separate calls are separate copies, so a field with widgets in both becomes two fields, and links and bookmarks between them are removed. Not carried: the structure tree (tags), page labels, optional content (layers) settings, named destinations as names, XFA, and fields without a widget on an appended page. Signatures are copied as they are; they cannot be valid in the new file. Nothing is changed if the arguments are refused, and a failure while copying from a damaged source leaves this document's pages, form and bookmarks as they were.

public PdfPageImportResult AppendPages(PdfDocument source, int startIndex, int pageCount, PdfPageImportOptions options)

Parameters

source PdfDocument

The document to take the pages from, opened with Import.

startIndex int

The index of the first page to append.

pageCount int

The number of pages to append, at least one.

options PdfPageImportOptions

Whether and where to add the source's bookmarks.

Returns

PdfPageImportResult