property DestinationCount: Integer; // read only
DestinationCount reports the number of named destinations registered with
the document, i.e. entries reachable through the catalog’s /Dests
dictionary or its /Names /Dests name tree (PDF 1.7 spec section 12.3.2.3).
A named destination binds a string label to a target page, a viewport rectangle and
optional zoom factor; bookmarks, link annotations and remote-goto actions reference
destinations either inline or by name.
The value is 0 when Active is False or when
no named destinations are declared (links and bookmarks may still work via inline
explicit destinations; only the “named” flavour participates in this count).
Use Destination[Index] with indices from 0 to
DestinationCount - 1 to obtain a TDestination record
(handle, name, page number, X/Y/Zoom, plus has-flags indicating which fields are
explicitly stored).
The cost is O(n) per access because PDFium walks the name tree each time.
For repeated lookups by name, prefer DestinationByName[Name] over a manual
loop — PDFium performs a balanced-tree search internally which scales better than
a linear scan.
Bookmarks property
is more direct; named destinations are mainly relevant when handling remote
references from other PDFs.
var I: Integer;
var D: TDestination;
for I := 0 to Pdf1.DestinationCount - 1 do
begin
D := Pdf1.Destination[I];
Memo1.Lines.Add(Format('%s → page %d', [D.Name, D.PageNumber]));
end;