 |
PdfPageCollection Class |
Represents the collection of pages in a PDF document. Accessed through
Pages; supports indexing, enumeration, and adding, inserting,
or removing pages.
Inheritance HierarchySystemObject
SelectPdf.UniversalPdfPageCollection
Namespace: SelectPdf.UniversalAssembly: SelectPdf.HtmlToPdf.Universal (in SelectPdf.HtmlToPdf.Universal.dll) Version: 26.4
Syntaxpublic class PdfPageCollection : IEnumerable<PdfPage>,
IEnumerable
Public Class PdfPageCollection
Implements IEnumerable(Of PdfPage), IEnumerable
The PdfPageCollection type exposes the following members.
Properties| | Name | Description |
|---|
 | Count |
Gets the number of pages in the collection.
|
 | Document |
Gets the parent pdf document of the pages collection.
|
 | Item |
Gets or sets the page at the specified index.
|
Top
Methods| | Name | Description |
|---|
  | Add |
Adds a new page to the document, using the document's default size and margins.
|
 | Add(PdfMargins) | Adds a new page with the specified margins. |
 | Add(PdfPage) |
Adds an existing page (from another document) to this document. The page is
imported by content — the source document is not modified and subsequent changes
to the source do not affect the imported copy.
|
 | Add(PdfPage) | Adds an array of existing pages (from another document) to this document. |
 | Add(PdfCustomPageSize, PdfMargins) | Adds a new page with the specified size and margins. |
 | Add(PdfCustomPageSize, PdfMargins, PdfPageOrientation) | Adds a new page with the specified size, margins, and orientation. |
 | Contains |
Checks whether the collection contains the specified page.
|
 | GetEnumerator |
Returns an enumerator that iterates through the page collection.
|
 | IndexOf |
Returns the zero-based index of the specified page.
|
 | Insert(Int32, PdfPage) |
Inserts an existing page at the specified index.
|
 | Insert(Int32, PdfCustomPageSize, PdfMargins, PdfPageOrientation) |
Inserts a new page at the specified index with the given size, margins, and orientation.
|
 | Remove |
Removes the specified page from the document.
|
 | RemoveAt |
Removes the page at the specified index.
|
Top
ExamplePdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
int count = document.Pages.Count;
PdfPage first = document.Pages[0];
document.Close();
Dim document As New PdfDocument()
Dim page As PdfPage = document.Pages.Add()
Dim count As Integer = document.Pages.Count
Dim first As PdfPage = document.Pages(0)
document.Close()
See Also