PDFsharp-net6

PdfPages

Namespace: PdfSharp.Pdf

Represents the pages of the document.

public sealed class PdfPages : PdfDictionary, System.ICloneable, System.Collections.Generic.IEnumerable`1[[System.Collections.Generic.KeyValuePair`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[PdfSharp.Pdf.PdfItem, PdfSharp, Version=0.1.3.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Collections.IEnumerable, System.Collections.Generic.IEnumerable`1[[PdfSharp.Pdf.PdfPage, PdfSharp, Version=0.1.3.0, Culture=neutral, PublicKeyToken=null]]

Inheritance ObjectPdfItemPdfObjectPdfDictionaryPdfPages
Implements ICloneable, IEnumerable<KeyValuePair<String, PdfItem>>, IEnumerable, IEnumerable<PdfPage>

Properties

Count

Gets the number of pages.

public int Count { get; }

Property Value

Int32

Item

public PdfPage Item { get; }

Property Value

PdfPage

PagesArray

Gets a PdfArray containing all pages of this document. The array must not be modified.

public PdfArray PagesArray { get; }

Property Value

PdfArray

Elements

Gets the dictionary containing the elements of this dictionary.

public DictionaryElements Elements { get; }

Property Value

DictionaryElements

Stream

Gets or sets the PDF stream belonging to this dictionary. Returns null if the dictionary has no stream. To create the stream, call the CreateStream function.

public PdfStream Stream { get; set; }

Property Value

PdfStream

Owner

Gets the PdfDocument this object belongs to.

public PdfDocument Owner { get; }

Property Value

PdfDocument

IsIndirect

Indicates whether the object is an indirect object.

public bool IsIndirect { get; }

Property Value

Boolean

Internals

Gets the PdfInternals object of this document, that grants access to some internal structures which are not part of the public interface of PdfDocument.

public PdfObjectInternals Internals { get; }

Property Value

PdfObjectInternals

Reference

Gets the indirect reference of this object. If the value is null, this object is a direct object.

public PdfReference Reference { get; internal set; }

Property Value

PdfReference

ReferenceNotNull

Gets the indirect reference of this object. Throws if it is null.

public PdfReference ReferenceNotNull { get; }

Property Value

PdfReference

Exceptions

InvalidOperationException
The indirect reference must be not null here.

Methods

FindPage(PdfObjectID)

Finds a page by its id. Transforms it to PdfPage if necessary.

internal PdfPage FindPage(PdfObjectID id)

Parameters

id PdfObjectID

Returns

PdfPage

Add()

Creates a new PdfPage, adds it to the end of this document, and returns it.

public PdfPage Add()

Returns

PdfPage

Add(PdfPage)

Adds the specified PdfPage to the end of this document and maybe returns a new PdfPage object. The value returned is a new object if the added page comes from a foreign document.

public PdfPage Add(PdfPage page)

Parameters

page PdfPage

Returns

PdfPage

Insert(Int32)

Creates a new PdfPage, inserts it at the specified position into this document, and returns it.

public PdfPage Insert(int index)

Parameters

index Int32

Returns

PdfPage

Insert(Int32, PdfPage)

Inserts the specified PdfPage at the specified position to this document and maybe returns a new PdfPage object. The value returned is a new object if the inserted page comes from a foreign document.

public PdfPage Insert(int index, PdfPage page)

Parameters

index Int32

page PdfPage

Returns

PdfPage

InsertRange(Int32, PdfDocument, Int32, Int32)

Inserts pages of the specified document into this document.

public void InsertRange(int index, PdfDocument document, int startIndex, int pageCount)

Parameters

index Int32
The index in this document where to insert the page .

document PdfDocument
The document to be inserted.

startIndex Int32
The index of the first page to be inserted.

pageCount Int32
The number of pages to be inserted.

InsertRange(Int32, PdfDocument)

Inserts all pages of the specified document into this document.

public void InsertRange(int index, PdfDocument document)

Parameters

index Int32
The index in this document where to insert the page .

document PdfDocument
The document to be inserted.

InsertRange(Int32, PdfDocument, Int32)

Inserts all pages of the specified document into this document.

public void InsertRange(int index, PdfDocument document, int startIndex)

Parameters

index Int32
The index in this document where to insert the page .

document PdfDocument
The document to be inserted.

startIndex Int32
The index of the first page to be inserted.

Remove(PdfPage)

Removes the specified page from the document.

public void Remove(PdfPage page)

Parameters

page PdfPage

RemoveAt(Int32)

Removes the specified page from the document.

public void RemoveAt(int index)

Parameters

index Int32

MovePage(Int32, Int32)

Moves a page within the page sequence.

public void MovePage(int oldIndex, int newIndex)

Parameters

oldIndex Int32
The page index before this operation.

newIndex Int32
The page index after this operation.

FlattenPageTree()

Replaces the page tree by a flat array of indirect references to the pages objects.

internal void FlattenPageTree()

PrepareForSave()

Prepares the document for saving.

internal void PrepareForSave()

GetEnumerator()

Gets the enumerator.

public IEnumerator<PdfPage> GetEnumerator()

Returns

IEnumerator<PdfPage>