Skip to main content

emit_outline

Function emit_outline 

Source
pub(crate) fn emit_outline(
    pdf: &mut Pdf,
    graph: &PageGraph,
    root: Ref,
    items: &[Ref],
    page_refs: &[(Ref, Ref)],
)
Expand description

Emit the /Outlines tree from graph.outline (flat, document order, each entry carrying a heading level 1..=3). Nesting is reconstructed in a single pass over a level stack of entry indices, then the root dict and one /Outline item per entry are wired with parent/prev/next/first/last links and page destinations.

items[i] is the indirect ref for graph.outline[i]; root is the /Outlines dict ref. Called only when graph.outline is non-empty, so items is non-empty and roots always has at least one member.