NAME

PDF::Make::Builder::Page - Page state and layout for PDF::Make

SYNOPSIS

use PDF::Make::Builder;

my $builder = PDF::Make::Builder->new(
    page_size => 'A4',
    padding   => 20,
    header    => { show_page_num => 'right' },
    footer    => { show_page_num => 'left' },
);

my $page = $builder->page;
my $y    = $page->cursor_y;
my $w    = $page->width;

DESCRIPTION

Represents a single page in the PDF document, tracking cursor position, layout dimensions, column state, and optional header/footer regions.

NOTE

Accessors use the page_ prefix (e.g. $page->page_w, $page->page_h) because bare names like w and h conflict with Perl builtins.

PROPERTIES

page_size (Str, default 'A4')

Named page size. Supported: A3, A4, A5, B5, Letter, Legal, Tabloid.

background (Str, default '#fff')

Background colour as a hex string.

columns (Int, default 1)

Number of text columns.

column (Int, default 1)

Current active column (1-based).

padding (Num, default 20)

Page margin in points.

num (Int, required)

1-based page number.

w (Num, required)

Page width in points.

h (Num, required)

Page height in points.

canvas (Any, required)

The low-level canvas object used to emit PDF drawing operators.

xs_page (Any, required)

The XS page handle from PDF::Make.

header (Any)

Optional PDF::Make::Builder::Page::Header instance.

Optional PDF::Make::Builder::Page::Footer instance.

METHODS

page_dimensions($size)

Class method. Returns (width, height) in points for the given page-size name (e.g. 'A4').

top_y()

Returns the Y coordinate of the top of the content area (below header, inside padding).

bottom_y()

Returns the Y coordinate of the bottom of the content area (above footer, inside padding).

remaining_height()

Returns the vertical space remaining between the cursor and the bottom of the content area.

width()

Returns the usable content width, accounting for padding and columns.

content_x()

Returns the X coordinate of the left edge of the current column.

cursor_y()

Returns the current vertical cursor position, defaulting to top_y if no content has been placed yet.

advance_y($dy)

Moves the cursor down by $dy points.

SEE ALSO

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