PDFium Delphi Component Docs

เมธอด BuildReflowDocument

Component: TPdf  ·  Unit: PDFium
สร้างโมเดลอ่านเชิงความหมายแบบมีขอบเขต สำหรับ HTML แบบ responsive, การอ่านบนมือถือ, accessibility และการทำดัชนี

Syntax

function BuildReflowDocument(
  const Options: TPdfReflowOptions;
  const CancellationToken: IPdfCancellationToken = nil): TPdfReflowDocument;

Description

BuildReflowDocument อ่านทุกหน้าที่เลือกผ่าน GetStructuredText ให้น้ำหนักความหมายแบบ Tagged PDF เป็นอันดับแรก แล้ว fallback ไปอนุมานจากเลย์เอาต์จริงเมื่อไม่มีโครงสร้าง

อาร์เรย์ TPdfReflowDocument.Nodes ที่คืนมาเป็น tree แบบ pre-order ที่เสถียร มี ParentIndex กับ Depth เลี่ยงความเป็นเจ้าของแบบเรียกซ้ำ พร้อมคงความสัมพันธ์ของหน้า, หัวข้อ, ย่อหน้า, รายการ, รูปภาพ, caption, ตาราง, แถว และเซลล์

TPdfReflowNode แต่ละตัวแบกหน้า, ข้อความ, ภาษา, แหล่งความหมาย, ขอบเขต, ระดับหัวข้อ, พิกัดตาราง RowIndex กับ ColumnIndex พร้อม span ของพวกมัน, สถานะ IsHeader และ confidence เมื่อใช้ได้

TPdfReflowOptions เลือกหน้าต่างหน้าและประตูเอาต์พุต; DetectTables เปิดการตรวจจับตารางพร้อมเรกคอร์ดงบ TableOptions ที่ซ้อนอยู่ และ TPdfReflowDocument ที่ได้เปิดเผย TableCount ที่ตรวจพบคู่กับ tree โหนด

ข้อความของตารางที่ตรวจพบจะแทนที่บล็อกย่อหน้าที่ทับซ้อนกัน เพื่อไม่ให้ผล reflow ซ้ำเนื้อหาตาราง

HTML output

TPdfReflowDocument.ToHtml ปล่อย element เชิงความหมายได้แก่ h1 ถึง h6, p, ul, li, figure, figcaption, table, th และ td

ค่าข้อความกับ attribute ถูก escape เสมอ span ของแถวกับคอลัมน์ถูกคงไว้ และ CSS แบบ responsive เสริมไม่ต้องใช้สคริปต์หรือ resource ภายนอก

FullDocument, IncludeCss, IncludePageSections, IncludeGeometry และ PreserveLineBreaks คุมการ serialize โดยไม่ต้อง parse PDF ซ้ำ

Ranges and budgets

Example

var
  Options: TPdfReflowOptions;
  Document: TPdfReflowDocument;
begin
  Options := TPdfReflowOptions.Default;
  Options.IncludeGeometry := True;
  Document := Pdf1.BuildReflowDocument(Options);
  Memo1.Text := Document.ToHtml;
end;

See Also

GetStructuredText, ExtractTables, ReadableContent