THPDFLayoutDiagnostic Record
單一結構化版面事件:發生了什麼與原因、涉及的頁面與矩形、行數、元素路徑,以及元素在原始碼中的選填位置
宣告
THPDFLayoutDiagnostic= record
Kind: THPDFLayoutDiagnosticKind;
PageIndex: Integer;
RelatedPageIndex: Integer;
X: Single;
Y: Single;
Width: Single;
Height: Single;
LineCount: Integer;
Reason: AnsiString;
ElementPath: AnsiString;
RelatedElementPath: AnsiString;
SourceFile: AnsiString;
SourceLine: Integer;
SourceColumn: Integer;
end;
單元
HPDFDoc
欄位
| 欄位 | 用途 |
|---|---|
Kind | THPDFLayoutDiagnosticKind 事件類別,例如 ldkAutomaticPageBreak 或 ldkKeepWithNext |
PageIndex | 事件發生的零基頁索引 |
RelatedPageIndex | 跨頁事件的配對頁面,例如元素分割到下一頁 |
X / Y / Width / Height | 事件涉及的放置矩形,術語與 THPDFLayoutBounds 相同 |
LineCount | 涉及的文字行數,例如自動分頁前已排版的行數 |
Reason | 說明記錄此事件原因的人類可讀文字 |
ElementPath | 事件所屬版面元素的路徑 |
RelatedElementPath | 重疊與分割事件中配對元素的路徑 |
SourceFile / SourceLine / SourceColumn | 啟用來源位置擷取時,透過 SetDiagnosticSource 擷取的宣告位置 |
使用說明
- 記錄由版面引擎在啟用診斷時產生,並透過
THotPDF.GetLayoutDiagnostics、THotPDF.GetLayoutDiagnostic或OnLayoutDiagnostic事件交付 - 用
Kind加ElementPath篩選,Reason則可直接顯示在記錄檔或問題清單中 - 矩形欄位餵給
THotPDF.DrawLayoutDiagnosticOverlay,讓事件直接在轉譯後的頁面上視覺化