function GetLinkedAnnotationIndex(AnnotIndex: Integer; Relationship: TPdfAnnotationRelationship): Integer;
| AnnotIndex | Integer。注释在当前页上的从零开始索引,范围为 0 .. AnnotationCount - 1。越界索引会抛出 EPdfError |
| Relationship | TPdfAnnotationRelationship。parPopup 跟随 /Popup 条目(标记注释的弹出窗口);parInReplyTo 跟随 /IRT 条目(本注释所答复的注释) |
| Result | Integer。所链接注释的页面索引,位于 0 .. AnnotationCount - 1;当注释没有此类链接时为 -1 |
标记注释可以引用其他注释。文本注释在 /Popup 中保存弹出窗口,答复注释则在 /IRT 中携带它所答复的注释。此调用通过原生接口(FPDFAnnot_GetLinkedAnnot)解析此类引用,并把被链接注释的句柄转换回其他各处使用的页面注释索引,调用方随后即可通过 Annotation 检查它
当注释没有所请求关系的条目时,结果为 -1。这是正常情况 — 大多数注释既不带弹出窗口也不带答复引用
要遍历整条答复线程而不只是单次跳转,请使用 GetLinkedAnnotationChain
AnnotIndex 一样索引到同一个 AnnotationCount 列表
var
PopupIndex: Integer;
begin
PopupIndex := Pdf1.GetLinkedAnnotationIndex(3, parPopup);
if PopupIndex >= 0 then
Memo1.Lines.Add(Pdf1.Annotation[PopupIndex].ContentsText);
end;