property LinkAnnotationCount[PageNumber: Integer]: Integer; // read only
LinkAnnotationCount는 1-based PageNumber 인자로 지정한 page의 subtype /Link entry 수를 반환합니다 (PDF 1.7 spec section 12.5.6.5). 현재 활성 page에만 제한되고 모든 annotation subtype을 세는 AnnotationCount와 달리, 이 indexed property는 어떤 page든 직접 대상으로 삼아 link annotation만 필터링합니다. 즉 텍스트나 그래픽 주위에 클릭 가능한 영역을 감싸고 destination, URI, launch action, named action을 가리키는 entry입니다
PageNumber는 1 .. PageCount 범위로 전달하세요. Active가 False이거나, page index가 유효하지 않거나, page에 link annotation이 전혀 없으면 값은 0입니다. PDFiumPas는 WebLinkCount를 통해 “auto-detected” web URL도 별도로 제공합니다. 이것들은 text-pattern scanning에서 나오며 LinkAnnotationCount의 일부가 아닙니다
LinkAnnotation[PageNumber, Index]를 사용해 0부터 LinkAnnotationCount[PageNumber] - 1까지의 index로 TLinkAnnotation record를 가져오세요. 여기에는 bounding rectangle, target page number, action type, multi-line link용 quadrilateral point, resolved action payload가 들어 있습니다. link metadata loading은 page당 O(n)이므로 여러 page를 순회할 때는 캐시하세요
Index와는 다릅니다WebLinkCount와 함께 사용하세요0을 반환합니다. try/except 없이 threaded probe 안에서 써도 됩니다
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;