Outline#
Outline (或“书签”)是 Document 的一个属性。如果它不是 None,则表示文档的第一个书签项。其属性定义了该书签项的特性,并且指向“水平方向”或向下的其他书签项。通过跟踪这些“指针”,可以恢复整个书签树,例如传统的目录(TOC)。
方法 / 属性 |
简短描述 |
---|---|
下一级书签项 |
|
同一级的下一个书签项 |
|
页码(从0开始) |
|
书签项的标题 |
|
进一步指定书签目标的字符串 |
|
目标是否在文档外部 |
|
子书签是否展开(打开)或折叠 |
|
指向目标详情对象 |
类 API
- class 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 之外的某个目标,可能是互联网资源(uri
以http://
或类似开头)、其他文件(uri
以file:
或file://
开头)或其他服务(如电子邮件地址,uri
以mailto:
开头)。is_external
为假时,uri
将为None
或指向一个内部位置。对于PDF文档,这应当是 #nnnn,表示一个基于1的页码 nnnn,或一个命名位置。其他文档类型的格式可能有所不同,例如对于XPS文档,格式可能为 “../FixedDoc.fdoc#PG_2_LNK_1”,表示XPS文档第2页(基于1的页码)。
- Type:
str
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 |
---|---|
next item downwards |
|
next item same level |
|
page number (0-based) |
|
title |
|
string further specifying outline target |
|
target outside document |
|
whether sub-outlines are open or collapsed |
|
points to destination details object |
Class API