AddRoleMap

標記 PDF, 無障礙

說明

本頁介紹 PDFlibPas 中屬於「標記 PDF, 無障礙」主題的 AddRoleMap。API 名稱、參數、類別名稱、檔案名稱和字面值保持原樣,以便和 Delphi 函式庫及 DLL 進入點完全對應。

呼叫函式前請查看語法、參數和傳回值。程式碼區塊保留原始形式,便於範例直接複製使用。

使用此 API 時,請注意 PDF/A 限制、所需最低 PDF 版本、外部資源以及目前選定的文件狀態。

呼叫函式前請查看語法、參數和傳回值。程式碼區塊保留原始形式,便於範例直接複製使用。 BeginTag, BeginTagEx

呼叫函式前請查看語法、參數和傳回值。程式碼區塊保留原始形式,便於範例直接複製使用。

語法

Delphi

Function TPDFlib.AddRoleMap(Const CustomType, StandardType: WideString): Integer;

ActiveX

Function PDFlib::AddRoleMap(CustomType As String, StandardType As String) As Long

DLL

int DLAddRoleMap(int InstanceID, const wchar_t * CustomType, const wchar_t * StandardType);

參數

CustomTypeCustomTypeAddRoleMap 的參數。請使用簽章中顯示的型別,並提供與目前 PDF 文件、所選頁面或作用中資源一致的值。 BeginTag, BeginTagEx
StandardTypeStandardTypeAddRoleMap 的參數。請使用簽章中顯示的型別,並提供與目前 PDF 文件、所選頁面或作用中資源一致的值。

傳回值

0此值說明 AddRoleMap 的呼叫結果。通常非零值表示成功,0 表示操作未完成。
1此值說明 AddRoleMap 的呼叫結果。通常非零值表示成功,0 表示操作未完成。

範例

// Document with custom element types mapped to standard PDF structure types
PDF.SetPDFUAMode('en-US');
PDF.AddRoleMap('Headline', 'H1');
PDF.AddRoleMap('Subheadline', 'H2');
PDF.AddRoleMap('Caption', 'P');

PDF.BeginTag('Headline', '', '');
PDF.PrintText(50, 750, 'Annual Report 2026');
PDF.EndTag;

PDF.BeginTag('Subheadline', '', '');
PDF.PrintText(50, 720, 'Financial Highlights');
PDF.EndTag;