NAME
PDF::Make::Builder::TOC - Table of contents for PDF::Make
SYNOPSIS
my $builder = PDF::Make::Builder->new(
toc => {
title => 'Contents',
font_args => { size => 11 },
level_indent => 3,
},
);
# Headings with toc => 1 auto-register entries
$builder->add_h1(text => 'Chapter 1', toc => 1);
# Render the TOC (usually on a dedicated page)
$builder->toc->render($builder);
DESCRIPTION
Collects heading entries during document construction and renders a formatted table of contents with dot leaders and page numbers.
PROPERTIES
- title (Str, default
'Table of Contents') -
Title displayed above the TOC entries.
- title_font_args (HashRef, default
{}) -
Font overrides for the title (e.g.
{ size => 30, colour => '#000' }). - title_padding (Num, default 10)
-
Vertical space below the title before the first entry.
- font_args (HashRef, default
{}) -
Font overrides for the TOC entries.
- padding (Num, default 0)
-
Extra vertical padding between entries.
- level_indent (Num, default 2)
-
Number of space-widths per indentation level.
- entries (ArrayRef, default
[]) -
Internal list of collected TOC entries.
METHODS
- outline($builder, $level, %args)
-
Adds a TOC entry.
$levelis the heading depth (1-6).%argsmust includetextandpage_num. - render($builder)
-
Renders the full table of contents onto the builder's current page.
SEE ALSO
PDF::Make::Builder, PDF::Make::Builder::TOC::Outline, PDF::Make::Builder::Text::H1