StructTreeRoot
StructTreeRoot
概述
StructTreeRoot 是 Aspose.PDF FOSS 为 TypeScript 提供的类。
文档的逻辑结构树:对 /StructTreeRoot 的实时句柄。
此类为 TypeScript 程序中的 StructTreeRoot 对象声明了 7 个方法。可用的方法包括:Append、ElementFor、ElementForObject、GetText、RegisterRole、ResolveRole、constructor。在安装 Aspose.PDF FOSS 为 TypeScript 提供的包后,所有公共成员对任何 TypeScript 应用程序均可访问。属性:Children、ClassMap、RoleMap。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
RoleMap | : Map<string, string> | 读取 | 自定义角色 -> 映射的角色名称,来源于 /RoleMap(值为名称字符串)。 |
ClassMap | : Map<string, PdfObject> | 读取 | 类名 -> 属性对象,来源于 /ClassMap(原始、未解析的值)。 |
Children | StructElement[] | 读取 | 获取子项。 |
方法
| 签名 | 描述 |
|---|---|
| `constructor(doc: Document, Dict: PdfDict, Ref: PdfRef | undefined)` |
ResolveRole(role: string) → string | 沿着从 role 开始的 RoleMap 链,直至标准结构类型。 |
ElementFor(structParentsKey: number, mcid: number) → `StructElement | undefined` |
ElementForObject(structParentKey: number) → `StructElement | undefined` |
GetText() → string | 整棵树的文本,按阅读顺序。 |
Append(type: string, opts: ElemOpts) → StructElement | 创建一个 type 的顶层结构元素并返回其句柄。 |
RegisterRole(custom: string, standard: string) | 在 the /RoleMap 中将自定义结构类型 custom 映射到标准类型 standard(写入字典并更新内存映射)。 |