StructElement
StructElement
概述
StructElement 是 Aspose.PDF FOSS 中用于 TypeScript 的类。
结构树中的节点:对其真实 /StructElem 字典的实时句柄。
此类为 TypeScript 程序中的 StructElement 对象声明了 10 个方法。可用的方法包括:AddAnnotation、Append、GetBBox、GetText、MarkContent、NextMcid、SetLayoutAttributes、SetListAttributes、SetTableAttributes、constructor。在安装了用于 TypeScript 的 Aspose.PDF FOSS 包之后,所有公共成员对任何 TypeScript 应用程序均可访问。属性:A、ActualText、Alt、Attributes、C、Children,以及另外 17 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
Type | string | 读取 | 获取类型。 |
StandardType | string | 读取 | 获取标准类型。 |
IsStandardType | boolean | 读取 | 获取标准类型。 |
Parent | `StructElement | undefined` | 读取 |
Children | StructElement[] | 读取 | 获取子元素。 |
Title | `string | undefined` | 读写 |
Alt | `string | undefined` | 读写 |
ActualText | `string | undefined` | 读写 |
Expansion | `string | undefined` | 读写 |
ID | `string | undefined` | 读写 |
Lang | `string | undefined` | 读写 |
EffectiveLang | `string | undefined` | 读取 |
Page | `Page | undefined` | 读取 |
Attributes | { A: PdfObject[]; C: PdfObject[] } | 读取 | 获取属性。 |
A | : PdfObject[] | 读取 | 获取 a。 |
C | : PdfObject[] | 读取 | 获取 c。 |
ContentItems | ContentItem[] | 读取 | 获取内容项。 |
Nodes | StructNode[] | 读取 | 获取节点。 |
g | : GlyphEvent | 读取 | 获取 g。 |
at | : number | 读取 | 获取 at。 |
TableAttributes | `TableAttributes | undefined` | 读取 |
ListAttributes | `ListAttributes | undefined` | 读取 |
LayoutAttributes | `LayoutAttributes | undefined` | 读取 |
方法
| 签名 | 描述 |
|---|---|
| `constructor(doc: Document, Dict: PdfDict, Ref: PdfRef | undefined, Root: StructTreeRoot)` |
GetText(skip: (e: StructElement) => boolean) → string | 此元素的文本及其后代的文本,按 /K(读取)顺序。 |
GetBBox(page: Page) → `[number, number, number, number] | undefined` |
Append(type: string, opts: ElemOpts) → StructElement | 在此元素下创建 type 的子结构元素;返回其句柄。 |
NextMcid(page: Page) → number | 为 page 在此元素上分配下一个 MCID,并连线 /ParentTree + /K。 |
MarkContent(page: Page, region: Rect) → number | 在此元素下标记已有页面内容:分配一个 MCID,并将内容位于 region 的顶层 show/Do 操作包装在 /<Type> <</MCID n>> BDC … EMC 中。 |
AddAnnotation(annotation: Annotation) | 标记注释(例如. |
SetTableAttributes(attrs: Partial<TableAttributes>) | 将表属性合并到此元素的 /A 中(将字段设置为 undefined 会删除该键)。 |
SetListAttributes(attrs: Partial<ListAttributes>) | 将列表属性合并到此元素的 /A 中。 |
SetLayoutAttributes(attrs: Partial<LayoutAttributes>) | 将布局属性合并到此元素的 /A 中。 |