BeginMarkedContent
標籤式 PDF、協助工具
描述
在目前的內容串流中寫入 BDC(Begin Marked Content with Property List)運算子,以開啟標記內容範圍。這通常用於建立結構化(標籤式)PDF,以滿足協助工具需求(例如 PDF/UA)標記內容範圍必須正確配對:
BeginMarkedContent 的每個呼叫都必須以對應的 EndMarkedContent 呼叫關閉。標記內容範圍可以巢狀
語法
Delphi
Function TPDFlib.BeginMarkedContent(Const TagType, AltText, ActualText, Lang, Expansion: WideString): Integer;參數
| TagType | 結構標籤名稱,例如 /Span、/P、/Figure 等。 |
|---|---|
| AltText | 供協助工具使用的替代描述文字(對應屬性清單中的 /Alt 索引鍵)。不需要時傳入空字串。 |
| ActualText | 取代字符表示、供螢幕助讀程式使用的實際文字(對應 /ActualText 索引鍵)。不需要時傳入空字串。 |
| Lang | 標記內容的自然語言代碼(例如 en-US,對應 /Lang 索引鍵)。不需要時傳入空字串。 |
| Expansion | 縮寫或首字母縮略詞的展開文字(對應 /E 索引鍵)。不需要時傳入空字串。 |
傳回值
| 0 | 沒有已開啟的文件,或標記內容寫入失敗。 |
|---|---|
| 1 | 標記內容範圍已成功開啟。 |
備註
若要建置符合規範的 Tagged PDF/UA 檔案,請確保邏輯結構標籤包住所有可見的文字與圖形。相較於 BeginTag,此函式提供更細緻的屬性對應
範例
// Heading, then a paragraph with marked content span
PDF.NewDocument;
PDF.AddPage;
PDF.BeginMarkedContent('/Span', 'Logo description', '', 'en-US', '');
// Draw graphics or print text here
PDF.EndMarkedContent;