PDFium Delphi Component Docs

เมธอด GetLinkedAnnotationChain

Component: TPdf  ·  Unit: PDFium
ไล่ความสัมพันธ์ /Popup หรือ /IRT ซ้ำ ๆ แล้วคืน index หน้าของ annotation ที่เชื่อมกันทุกตัวตามเส้นทาง พร้อมกันวนลูป

Syntax

function GetLinkedAnnotationChain(AnnotIndex: Integer; Relationship: TPdfAnnotationRelationship; MaxDepth: Integer = 64): TPdfIntegerArray;

AnnotIndexInteger index ของ annotation เริ่มต้นบนหน้าปัจจุบันแบบเริ่มที่ 0 ในช่วง 0 .. AnnotationCount - 1
RelationshipTPdfAnnotationRelationship parPopup ไล่ตาม entry /Popup ส่วน parInReplyTo ไล่ตาม entry การตอบกลับ /IRT
MaxDepthInteger จำนวน link สูงสุดที่จะไล่ตาม ต้องอยู่ระหว่าง 1 ถึง 4096 มิฉะนั้นจะเกิด EPdfError ค่าเริ่มต้นคือ 64
ResultTPdfIntegerArray index หน้าของ annotation ที่เชื่อมกัน เรียงตามลำดับที่ไปเยือน จะว่างเปล่าเมื่อ annotation เริ่มต้นไม่มี link แบบนี้

Description

เรียก GetLinkedAnnotationIndex ซ้ำ ๆ: จาก annotation เริ่มต้นจะไล่ตามความสัมพันธ์ที่ระบุไปยัง annotation ถัดไป แล้วทำซ้ำจากตัวนั้นต่อไป โดยเก็บ index ทุกตัวที่ผ่าน ผลลัพธ์คือเธรดการตอบกลับของการสนทนา หรือสาย popup chain ในรูปอาร์เรย์ index ของ annotation บนหน้าธรรมดา

การไล่หยุดเมื่อครบหนึ่งในสามเงื่อนไข: annotation ปัจจุบันไม่มี link ต่อ, จำนวน link ที่ไปเยือนถึง MaxDepth หรือ index ถัดไปจะกลับไปเจอ annotation ที่เคยเห็นแล้ว (index เริ่มต้นนับว่าเห็นแล้วด้วย) กลไกกันวนลูปนี้ทำให้การเรียกปลอดภัยกับเอกสารที่เสียโครงซึ่ง entry /IRT วนกลับมาที่เดิม

index เริ่มต้นไม่เคยอยู่ในผลลัพธ์ — มีเพียง annotation ที่มันชี้ไปถึงเท่านั้น annotation ที่ไม่มี link ตามที่ระบุจะให้อาร์เรย์ว่าง ไม่ใช่ error

Remarks

Example

var
  Chain: TPdfIntegerArray;
  Index: Integer;
begin
  // collect the whole reply thread under annotation 5
  Chain := Pdf1.GetLinkedAnnotationChain(5, parInReplyTo);
  for Index in Chain do
    Memo1.Lines.Add(Pdf1.Annotation[Index].ContentsText);
end;

See Also

GetLinkedAnnotationIndex, Annotation, AnnotationCount