Module fpdf.outline

Quoting section 8.2.2 "Document Outline" of the 2006 PDF spec 1.7:

The document outline consists of a tree-structured hierarchy of outline items (sometimes called bookmarks), which serve as a visual table of contents to display the document’s structure to the user.

The contents of this module are internal to fpdf2, and not part of the public API. They may change at any time without prior warning or any deprecation period, in non-backward-compatible ways.

Functions

def build_outline_objs(sections)

Build PDF objects constitutive of the documents outline, and yield them one by one, starting with the outline dictionary

Classes

class OutlineDictionary (**kwargs)

Main features of this class: * delay ID assignement * implement serializing

Expand source code Browse git
class OutlineDictionary(PDFObject):
    __slots__ = ("_id", "type", "first", "last", "count")  # RAM usage optimization

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.type = "/Outlines"
        self.first = None
        self.last = None
        self.count = 0

Ancestors

Instance variables

var count
var first
var last
var type

Inherited members

class OutlineItemDictionary (title: str, dest: Destination = None, struct_elem: StructElem = None)

Main features of this class: * delay ID assignement * implement serializing

Expand source code Browse git
class OutlineItemDictionary(PDFObject):
    __slots__ = (  # RAM usage optimization
        "_id",
        "title",
        "parent",
        "prev",
        "next",
        "first",
        "last",
        "count",
        "dest",
        "struct_elem",
    )

    def __init__(
        self,
        title: str,
        dest: Destination = None,
        struct_elem: StructElem = None,
    ):
        super().__init__()
        self.title = PDFString(title, encrypt=True)
        self.parent = None
        self.prev = None
        self.next = None
        self.first = None
        self.last = None
        self.count = 0
        self.dest = dest
        self.struct_elem = struct_elem

Ancestors

Instance variables

var count
var dest
var first
var last
var next
var parent
var prev
var struct_elem
var title

Inherited members

class OutlineSection (name: str, level: int, page_number: int, dest: Destination, struct_elem: Optional[StructElem] = None)

OutlineSection(name, level, page_number, dest, struct_elem)

Expand source code Browse git
class OutlineSection(NamedTuple):
    name: str
    level: int
    page_number: int
    dest: Destination
    struct_elem: Optional[StructElem] = None

Ancestors

  • builtins.tuple

Instance variables

var destDestination

Alias for field number 3

var level : int

Alias for field number 1

var name : str

Alias for field number 0

var page_number : int

Alias for field number 2

var struct_elem : Optional[StructElem]

Alias for field number 4