Outline#

Outline (或“书签”)是 Document 的一个属性。如果它不是 None,则表示文档的第一个书签项。其属性定义了该书签项的特性,并且指向“水平方向”或向下的其他书签项。通过跟踪这些“指针”,可以恢复整个书签树,例如传统的目录(TOC)。

方法 / 属性

简短描述

Outline.down

下一级书签项

Outline.next

同一级的下一个书签项

Outline.page

页码(从0开始)

Outline.title

书签项的标题

Outline.uri

进一步指定书签目标的字符串

Outline.is_external

目标是否在文档外部

Outline.is_open

子书签是否展开(打开)或折叠

Outline.dest

指向目标详情对象

类 API

class Outline#
down#

下一级书签项。如果该项没有子项,则为 None

Type:

Outline

next#

同一级的下一个书签项。如果这是该层级的最后一个书签项,则为 None

Type:

Outline

page#

此书签指向的页码(从0开始)。

Type:

int

title#

书签项的标题,以字符串形式表示,如果没有标题则为 None

Type:

str

is_open#

指示是否展开任何子书签项(True 为展开,False 为折叠)。此信息由PDF阅读器软件解释。

Type:

bool

is_external#

布尔值,指定目标是否在当前文档之外(True 为外部目标)。

Type:

bool

uri#

字符串,指定书签目标。在结合 is_external 属性时,uri 的含义如下:

  • is_external 为真时,uri 指向当前 PDF 之外的某个目标,可能是互联网资源(urihttp:// 或类似开头)、其他文件(urifile:file:// 开头)或其他服务(如电子邮件地址,urimailto: 开头)。

  • is_external 为假时,uri 将为 None 或指向一个内部位置。对于PDF文档,这应当是 #nnnn,表示一个基于1的页码 nnnn,或一个命名位置。其他文档类型的格式可能有所不同,例如对于XPS文档,格式可能为 “../FixedDoc.fdoc#PG_2_LNK_1”,表示XPS文档第2页(基于1的页码)。

Type:

str

dest#

书签链接目标的详情对象。

Type:

linkDest

outline (or “bookmark”), is a property of Document. If not None, it stands for the first outline item of the document. Its properties in turn define the characteristics of this item and also point to other outline items in “horizontal” or downward direction. The full tree of all outline items for e.g. a conventional table of contents (TOC) can be recovered by following these “pointers”.

Method / Attribute

Short Description

Outline.down

next item downwards

Outline.next

next item same level

Outline.page

page number (0-based)

Outline.title

title

Outline.uri

string further specifying outline target

Outline.is_external

target outside document

Outline.is_open

whether sub-outlines are open or collapsed

Outline.dest

points to destination details object

Class API


本软件按原样提供,不作任何明示或暗示担保。本软件根据许可分发,除非根据该许可条款明确授权,否则不得复制、修改或分发。请参阅 artifex.com 上的许可信息,或联系 Artifex Software Inc., 39 Mesa Street, Suite 108A, San Francisco CA 94129, United States 了解更多信息。