PDFium Delphi Component Docs

คุณสมบัติ StructureElementsForPage

Component: TPdf  ·  Unit: PDFium
คืน tagged structure tree ที่เก็บใน cache ของหน้าหนึ่ง ในรูปอาร์เรย์แบบแบนของ record ของ element

Syntax

property StructureElementsForPage[PageNumber: Integer]: TPdfStructureElements; // read only

PageNumberInteger. ลำดับหน้าแบบ one-based ภายในเอกสารที่โหลดอยู่
ResultTPdfStructureElements. อาร์เรย์ของ record TPdfStructureElement เรียงตามลำดับการเดินของเอกสาร

Description

การเข้าถึงหน้าหนึ่งครั้งแรกจะ parse tagged structure tree ด้วยขีดจำกัดของ TPdfStructureReadOptions.Default ซึ่งเป็น traversal ชุดเดียวกับ ReadStructureElements แล้วคืน element เป็น record แบบ managed ที่มีลิงก์ level และ parent สตริงชนิดและชื่อเรื่อง ข้อความ alternate และ actual ภาษา ตัวระบุ marked content แอตทริบิวต์ ข้อมูลตาราง และการอ้างอิง associated file

ทุกการเข้าถึงได้ deep clone กลับไป การแก้สตริงหรืออาร์เรย์ที่ได้มาจึงไม่มีทางกระทบ tree ใน cache หรือเอกสาร หน้าที่ไม่มีโครงสร้างแบบ tagged จะคืนอาร์เรย์ว่าง

tree ที่สมบูรณ์จะถูกเก็บใน cache แบบมีขอบเขตตามที่ StructureCacheCapacity อธิบาย และถูกวัดเทียบกับ CacheBudgetBytes การอ่านหน้าเดิมซ้ำจึงเสียแค่หนึ่งการโคลน แทนที่จะต้องเดิน native หนึ่งรอบ

Remarks

เรียกโดยไม่มีเอกสารที่ active จะทำให้เกิด EPdfError และถ้า PageNumber อยู่นอกช่วง 1 ถึง PageCount จะ raise EPdfError พร้อมข้อความ Incorrect page number

คุณสมบัติ StructureElements แบบไม่มี index จะส่งหน้าปัจจุบันมายังการ lookup นี้

ถ้าต้องการขีดจำกัดแบบกำหนดเอง หรือ visitor แบบ streaming ที่ไม่ต้องรวบทุก element มาเก็บ ให้ใช้ ReadStructureElements หรือ VisitStructureElements

Example

Elements := Pdf.StructureElementsForPage[PageNumber];
for I := 0 to High(Elements) do
  if Elements[I].MarkedContentID >= 0 then
    LogMarkedContent(Elements[I].TypeName, Elements[I].Level);

See Also

StructureCacheCapacity, StructureCacheCount, StructureTraversal, StructureElements, TPdfView.StructureElements