Table of Contents

Class PdfPageTree

Namespace
PdfEngine.Vector.Document
Assembly
PdfEngine.Vector.dll

Traverses the PDF page tree (/Pages) according to ISO 32000-2 Clause 7.7.3, resolving inherited attributes (MediaBox, CropBox, Resources, Rotate).

A tree loaded lazily (a document read by ranges) reads only its root at first: Count is the root's /Count, and each page is found when it is first asked for, by descending from the root with the /Count of the nodes on the way. Only the nodes on the path to that page are read.

public sealed class PdfPageTree
Inheritance
PdfPageTree
Inherited Members

Properties

Count

public int Count { get; }

Property Value

int

IsLazy

True when each page is found when it is first asked for (a document opened by ranges; see the class summary). Reading a page that the tree cannot place (a /Count that does not match the kids, a loop, a tree too deep) throws PdfEngine.Vector.Document.PdfPageTreeMismatchException, and the caller loads the tree whole instead. Bytes that are not loaded yet throw PdfDataNotLoadedException; nothing is kept from the failed read.

public bool IsLazy { get; init; }

Property Value

bool

PageAncestors

For each page, the object numbers of the /Pages nodes above it, root first (-1 for a node that is a direct object). Page-tree edits change the last one's /Kids and every /Count.

public IReadOnlyList<int[]> PageAncestors { get; }

Property Value

IReadOnlyList<int[]>

PageObjectNumbers

The object number of each page's dictionary, or -1 for a page written as a direct object.

public IReadOnlyList<int> PageObjectNumbers { get; }

Property Value

IReadOnlyList<int>

Pages

public IReadOnlyList<PdfPageNode> Pages { get; }

Property Value

IReadOnlyList<PdfPageNode>

Methods

LoadedPage(int)

The page at index (0-based) if it is read already, without reading anything: always, for a tree that is not lazy; null for a page of a lazy tree not asked for yet.

public PdfPageNode? LoadedPage(int index)

Parameters

index int

Returns

PdfPageNode