Docs de PDFiumVCL

Bookmark property

Esta entrada API conserva identificadores, firmas, bloques de código y términos PDF en su forma original.
Component: TPdf  ·  Unit: PDFium
Looks up a bookmark by its title string and returns the matching TBookmark record from the document outline tree defined in PDF section 12.3.3.

Syntax

property Bookmark[const Title: WString]: TBookmark; // read only

Description

The PDF outline (also called document outline or "bookmarks" in viewers like Acrobat) is a hierarchical tree of named entries that the user navigates from the side panel. Each entry has a title, an optional destination or action, and zero or more children. PDFiumVCL flattens the tree into a sequence of TBookmark records that retain the underlying FPDF_BOOKMARK handle plus pre-resolved title, target page number, action type, and action target.

The string-indexed Bookmark form performs a case-sensitive search across the entire outline tree (depth-first) and returns the first matching node. The returned record has Handle = nil and PageNumber = 0 when no entry with that title exists — check Handle before navigating.

Use Bookmarks to enumerate every node in document order, BookmarkChildren to walk one level of nesting, and BookmarkFrom to convert a raw handle (for example from a viewer-side click event) back to a populated record.

Parameters

TitleWString. The full bookmark title to match. Comparison is case-sensitive and exact (no substring or wildcard matching). Whitespace and punctuation in the title must be reproduced exactly as stored in the PDF outline.

Remarks

Example

var
  Bm: TBookmark;
begin
  Pdf1.LoadFromFile('specification.pdf');
  Bm := Pdf1.Bookmark['Chapter 5: Annotations'];
  if Bm.Handle <> nil then
  begin
    case Bm.Action of
      acGoto:     Pdf1.PageNumber := Bm.ActionPageNumber;
      acUri:      ShowMessage('URL bookmark');
      acGotoRemote: ShowMessage('External PDF target');
    end;
  end
  else
    ShowMessage('No bookmark with that title.');
end;

See Also

Bookmarks, BookmarkChildren, BookmarkFrom, HasBookmarkChildren, PageNumber