FindOutlineByTitle

Outlines

Description

Searches the document outline for the first node whose title matches the given text exactly and returns its outline ID, or 0 when no node matches or the starting outline is invalid. The depth selector limits the search to siblings of the start node, to its children, or to the whole subtree beneath it.

Syntax

Delphi

Function TPDFlib.FindOutlineByTitle(Const Title: WideString; StartOutlineID: Integer; Depth: TPDFlibOutlineSearchDepth): Integer;

Parameters

Title is the bookmark caption to look for, compared exactly and case-sensitively against the item's stored /Title text — no trimming, case folding or wildcard matching. StartOutlineID is where the search begins: 0 starts at the first top-level bookmark, and any other value must be an outline handle from NewOutline, GetFirstOutline, GetNextOutline or GetFirstChildOutline. Depth selects the scope, as osdSiblingsOnly, osdChildrenOnly or osdFullSubTree.

Return values

The PDF object number of the first matching bookmark, or 0 when nothing matches, the document has no outline, or StartOutlineID does not resolve to an outline node. The start node itself is always tested first, before Depth narrows the search.

Remarks

The walk stops at the first hit in document order, and the scopes are literal: osdSiblingsOnly visits only the following siblings of the start node, osdChildrenOnly only its direct children, and osdFullSubTree its descendants followed by the following siblings and their own subtrees. Preceding siblings and ancestors are never searched, so pass 0 as StartOutlineID for a document-wide lookup. The result is the node's object number rather than the opaque handle the other outline functions accept; walk the tree with GetFirstOutline and GetNextOutline and compare GetOutlineObjectNumber when a handle is needed.