property WebLink[PageNumber, Index: Integer]: TWebLink; // read only
WebLink returns a TWebLink record for the URL detected at the
specified 1-based PageNumber and 0-based Index. The record
contains the Url string (typically http://,
https://, or mailto:) and a Rectangles array of
TPdfRectangle bounding boxes — one rectangle per visual line, since
PDFium reports separate rectangles when a single URL wraps onto multiple lines.
Index ranges from 0 to WebLinkCount[PageNumber] - 1
Outside that range PDFium returns an empty record (Url is empty,
Rectangles가 nil인 경우). web link detection은 해당 page의 첫 읽기에서 지연 실행되며 page가 다시 로드될 때까지 캐시됩니다. WebLink 자체를 읽는 비용은 scan이 끝난 뒤 O(1)입니다
WebLink complements LinkAnnotation, which surfaces explicit
/Link annotations declared by the PDF author. rectangle을 사용해 사용자 지정 renderer에 click-through overlay를 만들거나 추출된 text에서 URL을 강조 표시하세요. 데이터는 read-only입니다 — PDFiumPas는 detection result만 노출하고
modification primitives. To insert real link annotations, use the
FPDFPage_CreateAnnot path on the underlying Page handle.
TPdfView.PageToScreen to overlay HTML or other widgets.TPdfView.OnAnnotationLinkClick and
TPdfView.OnWebLinkClick.
var Link: TWebLink;
var I: Integer;
for I := 0 to Pdf1.WebLinkCount[1] - 1 do
begin
Link := Pdf1.WebLink[1, I];
Memo1.Lines.Add(Format('%s (%d rects)',
[Link.Url, Length(Link.Rectangles)]));
end;