new_page_func => sub { my ($pdf) = @_; # I don't know whether that's the parameter passed to this warn "Creating new page"; my $page = $pdf->page; # see PDF::API2 for pages ... do funky stuff with $page .... $page },