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);
参数
| CustomType | CustomType 是 AddRoleMap 的参数。请使用签名中显示的类型,并提供与当前 PDF 文档、所选页面或活动资源一致的值。 BeginTag, BeginTagEx |
|---|---|
| StandardType | StandardType 是 AddRoleMap 的参数。请使用签名中显示的类型,并提供与当前 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;