PDFiumVCL Docs

LinkAnnotationCount property

Component: TPdf  ·  Unit: PDFium
Number of /Link annotation entries on a specific page.

Syntax

property LinkAnnotationCount[PageNumber: Integer]: Integer; // read only

Description

LinkAnnotationCount returns the count of subtype /Link entries on the page identified by the 1-based PageNumber argument (PDF 1.7 spec section 12.5.6.5). Unlike AnnotationCount, which is restricted to the currently active page and counts every annotation subtype, this indexed property targets any page directly and filters to link annotations only — the entries that wrap a clickable region around text or graphics and point to a destination, URI, launch action or named action.

Pass PageNumber in the range 1 .. PageCount. The value is 0 when Active is False, when the page index is invalid, or when the page simply contains no link annotations. PDFiumVCL also exposes “auto-detected” web URLs separately through WebLinkCount — those come from text-pattern scanning and are not part of LinkAnnotationCount.

Use LinkAnnotation[PageNumber, Index] with indices from 0 to LinkAnnotationCount[PageNumber] - 1 to retrieve a TLinkAnnotation record — bounding rectangle, target page number, action type, quadrilateral points for multi-line links, and the resolved action payload. Loading link metadata is O(n) per page; cache when iterating many pages.

Remarks

Example

var P, I: Integer;
var Link: TLinkAnnotation;
for P := 1 to Pdf1.PageCount do
  for I := 0 to Pdf1.LinkAnnotationCount[P] - 1 do
  begin
    Link := Pdf1.LinkAnnotation[P, I];
    Memo1.Lines.Add(Format('p%d link → page %d', [P, Link.PageNumber]));
  end;

See Also

LinkAnnotation, WebLinkCount, AnnotationCount, PageCount