NAME

PDF::Make::Builder::Page::Footer - Repeating page footer for PDF::Make

SYNOPSIS

use PDF::Make::Builder;

my $builder = PDF::Make::Builder->new(
    footer => {
        h             => 30,
        show_page_num => 'left',
        page_num_text => 'Page {num}',
    },
);

DESCRIPTION

Defines a footer region rendered at the bottom of every page. Supports automatic page numbering and an optional custom render callback.

PROPERTIES

h (Num, default 30)

Height of the footer region in points.

padding (Num, default 20)

Horizontal padding inside the footer.

show_page_num (Str)

Where to show the page number: 'left', 'center', or 'right'. Omit to hide.

page_num_text (Str, default 'Page {num}')

Template string for the page number. {num} is replaced with the current page number.

cb (CodeRef)

Custom render callback invoked as

$cb->($self, $builder,
      ctx      => $ctx,
      canvas   => $canvas, y => $y, w => $w, h => $h,
      page_num => $page_num);

$ctx is a PDF::Make::Builder::Page::HeaderFooterContext providing region-aware helpers (text, page_num, line, box, image, note, link) and region accessors (left, right, top, bottom, center_x, center_y, inset). The raw canvas, y, w, h, page_num args are retained for backward compatibility.

EXAMPLE

$builder->add_page_footer(
    h  => 30,
    cb => sub {
        my ($self, $builder, %args) = @_;
        my $ctx = $args{ctx};
        $ctx->line(y1 => $ctx->top - 2, y2 => $ctx->top - 2,
                   colour => '#ccc');
        $ctx->text(text => 'Confidential', align => 'left',
                   font => { size => 8, colour => '#666' });
        $ctx->page_num(format => 'Page {num} of {total}', align => 'right');
    },
);

METHODS

render($builder, $page, $page_num)

Renders the footer onto the given page.

SEE ALSO

PDF::Make::Builder::Page, PDF::Make::Builder::Page::Header