THotPDF.FindLoadedBookmarkPageIndex Method

Syntax

function FindLoadedBookmarkPageIndex(const Title: AnsiString): Integer;

Description

FindLoadedBookmarkPageIndex searches the loaded document outline tree for a bookmark title and returns the destination page index. The search is case-insensitive, walks child bookmarks before sibling bookmarks, and returns a zero-based page index.

The method resolves explicit destination arrays stored in /Dest and local GoTo actions stored in /A /D. It returns -1 when the bookmark title is not found, the loaded document has no outlines, or the bookmark uses a destination form that cannot be resolved to a loaded page.

Example

PDF.LoadFromFile('Manual.pdf');
PageIndex := PDF.FindLoadedBookmarkPageIndex('Installation');
if PageIndex >= 0 then
  Writeln('Bookmark is on page ', PageIndex + 1);

See Also